1 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2 | return new (P || (P = Promise))(function (resolve, reject) {
|
3 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
4 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
5 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
6 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
7 | });
|
8 | };
|
9 | var __generator = (this && this.__generator) || function (thisArg, body) {
|
10 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
11 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
12 | function verb(n) { return function (v) { return step([n, v]); }; }
|
13 | function step(op) {
|
14 | if (f) throw new TypeError("Generator is already executing.");
|
15 | while (_) try {
|
16 | if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
|
17 | if (y = 0, t) op = [0, t.value];
|
18 | switch (op[0]) {
|
19 | case 0: case 1: t = op; break;
|
20 | case 4: _.label++; return { value: op[1], done: false };
|
21 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
22 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
23 | default:
|
24 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
25 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
26 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
27 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
28 | if (t[2]) _.ops.pop();
|
29 | _.trys.pop(); continue;
|
30 | }
|
31 | op = body.call(thisArg, _);
|
32 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
33 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
34 | }
|
35 | };
|
36 | var _this = this;
|
37 | Object.defineProperty(exports, "__esModule", { value: true });
|
38 | var impl_1 = require("./impl");
|
39 | var platform_1 = require("../../platform");
|
40 | exports.applicationBuilderFromModule = function (moduleType, templateDocument) {
|
41 | var platform = null;
|
42 | var dispose = function () { return __awaiter(_this, void 0, void 0, function () {
|
43 | return __generator(this, function (_a) {
|
44 | switch (_a.label) {
|
45 | case 0:
|
46 | if (!platform) return [3 , 2];
|
47 | return [4 , platform.destroy()];
|
48 | case 1:
|
49 | _a.sent();
|
50 | _a.label = 2;
|
51 | case 2: return [2 ];
|
52 | }
|
53 | });
|
54 | }); };
|
55 | var build = function (operation) {
|
56 | platform = platform_1.createJitPlatform();
|
57 | var promise = platform.compileModule(moduleType);
|
58 | return new impl_1.ApplicationImpl(platform, operation, promise, undefined, dispose);
|
59 | };
|
60 | return new impl_1.ApplicationBuilderImpl(build, dispose, templateDocument);
|
61 | };
|
62 |
|
\ | No newline at end of file |