1 | "use strict";
|
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7 | };
|
8 | var __metadata = (this && this.__metadata) || function (k, v) {
|
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10 | };
|
11 | var core_1 = require('@angular/core');
|
12 | var tutorials_registry_cache_1 = require('./tutorials-registry-cache');
|
13 | var rxjs_1 = require('rxjs');
|
14 | var steps_templates_loader_1 = require('./steps-templates-loader');
|
15 | var PatchLoadResolve = (function () {
|
16 | function PatchLoadResolve(cache, templatesCache) {
|
17 | this.cache = cache;
|
18 | this.templatesCache = templatesCache;
|
19 | }
|
20 | PatchLoadResolve.prototype.resolve = function (route) {
|
21 | var data = route.data;
|
22 | var templatePath = data.tutorialObject.gitHub + '/' + data.gitTagRevision + data.stepObject.template;
|
23 | var tutorialPatchObservable = this.cache.load(data.tutorialObject.id, data.gitTagRevision, data.tutorialObject);
|
24 | var stepHtmlObservable = this.templatesCache.load(data.tutorialObject.id, templatePath);
|
25 | return rxjs_1.Observable.zip(tutorialPatchObservable, stepHtmlObservable, function (tutorial, step) {
|
26 | return { tutorial: tutorial, step: step, gitTagRevision: data.gitTagRevision, steps: data.steps };
|
27 | });
|
28 | };
|
29 | PatchLoadResolve = __decorate([
|
30 | core_1.Injectable(),
|
31 | __metadata('design:paramtypes', [tutorials_registry_cache_1.TutorialRegistryCache, steps_templates_loader_1.StepsTemplatesLoader])
|
32 | ], PatchLoadResolve);
|
33 | return PatchLoadResolve;
|
34 | }());
|
35 | exports.PatchLoadResolve = PatchLoadResolve;
|
36 |
|
\ | No newline at end of file |