Front end of the Slack clone application.

platform-browser-dynamic.js 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. /**
  2. * @license Angular v5.2.11
  3. * (c) 2010-2018 Google, Inc. https://angular.io/
  4. * License: MIT
  5. */
  6. import { CompileMetadataResolver, CompileReflector, CompilerConfig, DirectiveNormalizer, DirectiveResolver, DomElementSchemaRegistry, ElementSchemaRegistry, HtmlParser, I18NHtmlParser, Identifiers, JitCompiler, JitSummaryResolver, Lexer, NgModuleCompiler, NgModuleResolver, Parser, PipeResolver, ProviderMeta, ResourceLoader, StaticSymbolCache, StyleCompiler, SummaryResolver, TemplateParser, UrlResolver, ViewCompiler, getUrlScheme, syntaxError } from '@angular/compiler';
  7. import { ANALYZE_FOR_ENTRY_COMPONENTS, COMPILER_OPTIONS, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, ComponentFactory, ComponentFactoryResolver, ComponentRef, ElementRef, Inject, Injectable, InjectionToken, Injector, LOCALE_ID, MissingTranslationStrategy, NgModuleFactory, NgModuleRef, Optional, PACKAGE_ROOT_URL, PLATFORM_ID, QueryList, Renderer, SecurityContext, TRANSLATIONS, TRANSLATIONS_FORMAT, TemplateRef, Version, ViewContainerRef, ViewEncapsulation, createPlatformFactory, isDevMode, platformCore, ɵCodegenComponentFactoryResolver, ɵConsole, ɵEMPTY_ARRAY, ɵEMPTY_MAP, ɵReflectionCapabilities, ɵand, ɵccf, ɵcmf, ɵcrt, ɵdid, ɵeld, ɵglobal, ɵinlineInterpolate, ɵinterpolate, ɵmod, ɵmpd, ɵncd, ɵnov, ɵpad, ɵpid, ɵpod, ɵppd, ɵprd, ɵqud, ɵregisterModuleFactory, ɵstringify, ɵted, ɵunv, ɵvid } from '@angular/core';
  8. import { ɵPLATFORM_BROWSER_ID } from '@angular/common';
  9. import { ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS } from '@angular/platform-browser';
  10. /**
  11. * @fileoverview added by tsickle
  12. * @suppress {checkTypes} checked by tsc
  13. */
  14. /**
  15. * @license
  16. * Copyright Google Inc. All Rights Reserved.
  17. *
  18. * Use of this source code is governed by an MIT-style license that can be
  19. * found in the LICENSE file at https://angular.io/license
  20. */
  21. const MODULE_SUFFIX = '';
  22. const builtinExternalReferences = createBuiltinExternalReferencesMap();
  23. class JitReflector {
  24. constructor() {
  25. this.builtinExternalReferences = new Map();
  26. this.reflectionCapabilities = new ɵReflectionCapabilities();
  27. }
  28. /**
  29. * @param {?} type
  30. * @param {?} cmpMetadata
  31. * @return {?}
  32. */
  33. componentModuleUrl(type, cmpMetadata) {
  34. const /** @type {?} */ moduleId = cmpMetadata.moduleId;
  35. if (typeof moduleId === 'string') {
  36. const /** @type {?} */ scheme = getUrlScheme(moduleId);
  37. return scheme ? moduleId : `package:${moduleId}${MODULE_SUFFIX}`;
  38. }
  39. else if (moduleId !== null && moduleId !== void 0) {
  40. throw syntaxError(`moduleId should be a string in "${ɵstringify(type)}". See https://goo.gl/wIDDiL for more information.\n` +
  41. `If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc.`);
  42. }
  43. return `./${ɵstringify(type)}`;
  44. }
  45. /**
  46. * @param {?} typeOrFunc
  47. * @return {?}
  48. */
  49. parameters(typeOrFunc) {
  50. return this.reflectionCapabilities.parameters(typeOrFunc);
  51. }
  52. /**
  53. * @param {?} typeOrFunc
  54. * @return {?}
  55. */
  56. annotations(typeOrFunc) {
  57. return this.reflectionCapabilities.annotations(typeOrFunc);
  58. }
  59. /**
  60. * @param {?} typeOrFunc
  61. * @return {?}
  62. */
  63. propMetadata(typeOrFunc) {
  64. return this.reflectionCapabilities.propMetadata(typeOrFunc);
  65. }
  66. /**
  67. * @param {?} type
  68. * @param {?} lcProperty
  69. * @return {?}
  70. */
  71. hasLifecycleHook(type, lcProperty) {
  72. return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
  73. }
  74. /**
  75. * @param {?} type
  76. * @return {?}
  77. */
  78. guards(type) { return this.reflectionCapabilities.guards(type); }
  79. /**
  80. * @param {?} ref
  81. * @return {?}
  82. */
  83. resolveExternalReference(ref) {
  84. return builtinExternalReferences.get(ref) || ref.runtime;
  85. }
  86. }
  87. /**
  88. * @return {?}
  89. */
  90. function createBuiltinExternalReferencesMap() {
  91. const /** @type {?} */ map = new Map();
  92. map.set(Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS, ANALYZE_FOR_ENTRY_COMPONENTS);
  93. map.set(Identifiers.ElementRef, ElementRef);
  94. map.set(Identifiers.NgModuleRef, NgModuleRef);
  95. map.set(Identifiers.ViewContainerRef, ViewContainerRef);
  96. map.set(Identifiers.ChangeDetectorRef, ChangeDetectorRef);
  97. map.set(Identifiers.QueryList, QueryList);
  98. map.set(Identifiers.TemplateRef, TemplateRef);
  99. map.set(Identifiers.CodegenComponentFactoryResolver, ɵCodegenComponentFactoryResolver);
  100. map.set(Identifiers.ComponentFactoryResolver, ComponentFactoryResolver);
  101. map.set(Identifiers.ComponentFactory, ComponentFactory);
  102. map.set(Identifiers.ComponentRef, ComponentRef);
  103. map.set(Identifiers.NgModuleFactory, NgModuleFactory);
  104. map.set(Identifiers.createModuleFactory, ɵcmf);
  105. map.set(Identifiers.moduleDef, ɵmod);
  106. map.set(Identifiers.moduleProviderDef, ɵmpd);
  107. map.set(Identifiers.RegisterModuleFactoryFn, ɵregisterModuleFactory);
  108. map.set(Identifiers.Injector, Injector);
  109. map.set(Identifiers.ViewEncapsulation, ViewEncapsulation);
  110. map.set(Identifiers.ChangeDetectionStrategy, ChangeDetectionStrategy);
  111. map.set(Identifiers.SecurityContext, SecurityContext);
  112. map.set(Identifiers.LOCALE_ID, LOCALE_ID);
  113. map.set(Identifiers.TRANSLATIONS_FORMAT, TRANSLATIONS_FORMAT);
  114. map.set(Identifiers.inlineInterpolate, ɵinlineInterpolate);
  115. map.set(Identifiers.interpolate, ɵinterpolate);
  116. map.set(Identifiers.EMPTY_ARRAY, ɵEMPTY_ARRAY);
  117. map.set(Identifiers.EMPTY_MAP, ɵEMPTY_MAP);
  118. map.set(Identifiers.Renderer, Renderer);
  119. map.set(Identifiers.viewDef, ɵvid);
  120. map.set(Identifiers.elementDef, ɵeld);
  121. map.set(Identifiers.anchorDef, ɵand);
  122. map.set(Identifiers.textDef, ɵted);
  123. map.set(Identifiers.directiveDef, ɵdid);
  124. map.set(Identifiers.providerDef, ɵprd);
  125. map.set(Identifiers.queryDef, ɵqud);
  126. map.set(Identifiers.pureArrayDef, ɵpad);
  127. map.set(Identifiers.pureObjectDef, ɵpod);
  128. map.set(Identifiers.purePipeDef, ɵppd);
  129. map.set(Identifiers.pipeDef, ɵpid);
  130. map.set(Identifiers.nodeValue, ɵnov);
  131. map.set(Identifiers.ngContentDef, ɵncd);
  132. map.set(Identifiers.unwrapValue, ɵunv);
  133. map.set(Identifiers.createRendererType2, ɵcrt);
  134. map.set(Identifiers.createComponentFactory, ɵccf);
  135. return map;
  136. }
  137. /**
  138. * @fileoverview added by tsickle
  139. * @suppress {checkTypes} checked by tsc
  140. */
  141. /**
  142. * @license
  143. * Copyright Google Inc. All Rights Reserved.
  144. *
  145. * Use of this source code is governed by an MIT-style license that can be
  146. * found in the LICENSE file at https://angular.io/license
  147. */
  148. const ERROR_COLLECTOR_TOKEN = new InjectionToken('ErrorCollector');
  149. /**
  150. * A default provider for {\@link PACKAGE_ROOT_URL} that maps to '/'.
  151. */
  152. const DEFAULT_PACKAGE_URL_PROVIDER = {
  153. provide: PACKAGE_ROOT_URL,
  154. useValue: '/'
  155. };
  156. const _NO_RESOURCE_LOADER = {
  157. /**
  158. * @param {?} url
  159. * @return {?}
  160. */
  161. get(url) {
  162. throw new Error(`No ResourceLoader implementation has been provided. Can't read the url "${url}"`);
  163. }
  164. };
  165. const baseHtmlParser = new InjectionToken('HtmlParser');
  166. class CompilerImpl {
  167. /**
  168. * @param {?} injector
  169. * @param {?} _metadataResolver
  170. * @param {?} templateParser
  171. * @param {?} styleCompiler
  172. * @param {?} viewCompiler
  173. * @param {?} ngModuleCompiler
  174. * @param {?} summaryResolver
  175. * @param {?} compileReflector
  176. * @param {?} compilerConfig
  177. * @param {?} console
  178. */
  179. constructor(injector, _metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console) {
  180. this._metadataResolver = _metadataResolver;
  181. this._delegate = new JitCompiler(_metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console, this.getExtraNgModuleProviders.bind(this));
  182. this.injector = injector;
  183. }
  184. /**
  185. * @return {?}
  186. */
  187. getExtraNgModuleProviders() {
  188. return [this._metadataResolver.getProviderMetadata(new ProviderMeta(Compiler, { useValue: this }))];
  189. }
  190. /**
  191. * @template T
  192. * @param {?} moduleType
  193. * @return {?}
  194. */
  195. compileModuleSync(moduleType) {
  196. return /** @type {?} */ (this._delegate.compileModuleSync(moduleType));
  197. }
  198. /**
  199. * @template T
  200. * @param {?} moduleType
  201. * @return {?}
  202. */
  203. compileModuleAsync(moduleType) {
  204. return /** @type {?} */ (this._delegate.compileModuleAsync(moduleType));
  205. }
  206. /**
  207. * @template T
  208. * @param {?} moduleType
  209. * @return {?}
  210. */
  211. compileModuleAndAllComponentsSync(moduleType) {
  212. const /** @type {?} */ result = this._delegate.compileModuleAndAllComponentsSync(moduleType);
  213. return {
  214. ngModuleFactory: /** @type {?} */ (result.ngModuleFactory),
  215. componentFactories: /** @type {?} */ (result.componentFactories),
  216. };
  217. }
  218. /**
  219. * @template T
  220. * @param {?} moduleType
  221. * @return {?}
  222. */
  223. compileModuleAndAllComponentsAsync(moduleType) {
  224. return this._delegate.compileModuleAndAllComponentsAsync(moduleType)
  225. .then((result) => ({
  226. ngModuleFactory: /** @type {?} */ (result.ngModuleFactory),
  227. componentFactories: /** @type {?} */ (result.componentFactories),
  228. }));
  229. }
  230. /**
  231. * @param {?} summaries
  232. * @return {?}
  233. */
  234. loadAotSummaries(summaries) { this._delegate.loadAotSummaries(summaries); }
  235. /**
  236. * @param {?} ref
  237. * @return {?}
  238. */
  239. hasAotSummary(ref) { return this._delegate.hasAotSummary(ref); }
  240. /**
  241. * @template T
  242. * @param {?} component
  243. * @return {?}
  244. */
  245. getComponentFactory(component) {
  246. return /** @type {?} */ (this._delegate.getComponentFactory(component));
  247. }
  248. /**
  249. * @return {?}
  250. */
  251. clearCache() { this._delegate.clearCache(); }
  252. /**
  253. * @param {?} type
  254. * @return {?}
  255. */
  256. clearCacheFor(type) { this._delegate.clearCacheFor(type); }
  257. }
  258. /**
  259. * A set of providers that provide `JitCompiler` and its dependencies to use for
  260. * template compilation.
  261. */
  262. const COMPILER_PROVIDERS = /** @type {?} */ ([
  263. { provide: CompileReflector, useValue: new JitReflector() },
  264. { provide: ResourceLoader, useValue: _NO_RESOURCE_LOADER },
  265. { provide: JitSummaryResolver, deps: [] },
  266. { provide: SummaryResolver, useExisting: JitSummaryResolver },
  267. { provide: ɵConsole, deps: [] },
  268. { provide: Lexer, deps: [] },
  269. { provide: Parser, deps: [Lexer] },
  270. {
  271. provide: baseHtmlParser,
  272. useClass: HtmlParser,
  273. deps: [],
  274. },
  275. {
  276. provide: I18NHtmlParser,
  277. useFactory: (parser, translations, format, config, console) => {
  278. translations = translations || '';
  279. const /** @type {?} */ missingTranslation = translations ? /** @type {?} */ ((config.missingTranslation)) : MissingTranslationStrategy.Ignore;
  280. return new I18NHtmlParser(parser, translations, format, missingTranslation, console);
  281. },
  282. deps: [
  283. baseHtmlParser,
  284. [new Optional(), new Inject(TRANSLATIONS)],
  285. [new Optional(), new Inject(TRANSLATIONS_FORMAT)],
  286. [CompilerConfig],
  287. [ɵConsole],
  288. ]
  289. },
  290. {
  291. provide: HtmlParser,
  292. useExisting: I18NHtmlParser,
  293. },
  294. {
  295. provide: TemplateParser, deps: [CompilerConfig, CompileReflector,
  296. Parser, ElementSchemaRegistry,
  297. I18NHtmlParser, ɵConsole]
  298. },
  299. { provide: DirectiveNormalizer, deps: [ResourceLoader, UrlResolver, HtmlParser, CompilerConfig] },
  300. { provide: CompileMetadataResolver, deps: [CompilerConfig, HtmlParser, NgModuleResolver,
  301. DirectiveResolver, PipeResolver,
  302. SummaryResolver,
  303. ElementSchemaRegistry,
  304. DirectiveNormalizer, ɵConsole,
  305. [Optional, StaticSymbolCache],
  306. CompileReflector,
  307. [Optional, ERROR_COLLECTOR_TOKEN]] },
  308. DEFAULT_PACKAGE_URL_PROVIDER,
  309. { provide: StyleCompiler, deps: [UrlResolver] },
  310. { provide: ViewCompiler, deps: [CompileReflector] },
  311. { provide: NgModuleCompiler, deps: [CompileReflector] },
  312. { provide: CompilerConfig, useValue: new CompilerConfig() },
  313. { provide: Compiler, useClass: CompilerImpl, deps: [Injector, CompileMetadataResolver,
  314. TemplateParser, StyleCompiler,
  315. ViewCompiler, NgModuleCompiler,
  316. SummaryResolver, CompileReflector, CompilerConfig,
  317. ɵConsole] },
  318. { provide: DomElementSchemaRegistry, deps: [] },
  319. { provide: ElementSchemaRegistry, useExisting: DomElementSchemaRegistry },
  320. { provide: UrlResolver, deps: [PACKAGE_ROOT_URL] },
  321. { provide: DirectiveResolver, deps: [CompileReflector] },
  322. { provide: PipeResolver, deps: [CompileReflector] },
  323. { provide: NgModuleResolver, deps: [CompileReflector] },
  324. ]);
  325. /**
  326. * \@experimental
  327. */
  328. class JitCompilerFactory {
  329. /**
  330. * @param {?} defaultOptions
  331. */
  332. constructor(defaultOptions) {
  333. const /** @type {?} */ compilerOptions = {
  334. useJit: true,
  335. defaultEncapsulation: ViewEncapsulation.Emulated,
  336. missingTranslation: MissingTranslationStrategy.Warning,
  337. enableLegacyTemplate: false,
  338. };
  339. this._defaultOptions = [compilerOptions, ...defaultOptions];
  340. }
  341. /**
  342. * @param {?=} options
  343. * @return {?}
  344. */
  345. createCompiler(options = []) {
  346. const /** @type {?} */ opts = _mergeOptions(this._defaultOptions.concat(options));
  347. const /** @type {?} */ injector = Injector.create([
  348. COMPILER_PROVIDERS, {
  349. provide: CompilerConfig,
  350. useFactory: () => {
  351. return new CompilerConfig({
  352. // let explicit values from the compiler options overwrite options
  353. // from the app providers
  354. useJit: opts.useJit,
  355. jitDevMode: isDevMode(),
  356. // let explicit values from the compiler options overwrite options
  357. // from the app providers
  358. defaultEncapsulation: opts.defaultEncapsulation,
  359. missingTranslation: opts.missingTranslation,
  360. enableLegacyTemplate: opts.enableLegacyTemplate,
  361. preserveWhitespaces: opts.preserveWhitespaces,
  362. });
  363. },
  364. deps: []
  365. },
  366. /** @type {?} */ ((opts.providers))
  367. ]);
  368. return injector.get(Compiler);
  369. }
  370. }
  371. /**
  372. * @param {?} optionsArr
  373. * @return {?}
  374. */
  375. function _mergeOptions(optionsArr) {
  376. return {
  377. useJit: _lastDefined(optionsArr.map(options => options.useJit)),
  378. defaultEncapsulation: _lastDefined(optionsArr.map(options => options.defaultEncapsulation)),
  379. providers: _mergeArrays(optionsArr.map(options => /** @type {?} */ ((options.providers)))),
  380. missingTranslation: _lastDefined(optionsArr.map(options => options.missingTranslation)),
  381. enableLegacyTemplate: _lastDefined(optionsArr.map(options => options.enableLegacyTemplate)),
  382. preserveWhitespaces: _lastDefined(optionsArr.map(options => options.preserveWhitespaces)),
  383. };
  384. }
  385. /**
  386. * @template T
  387. * @param {?} args
  388. * @return {?}
  389. */
  390. function _lastDefined(args) {
  391. for (let /** @type {?} */ i = args.length - 1; i >= 0; i--) {
  392. if (args[i] !== undefined) {
  393. return args[i];
  394. }
  395. }
  396. return undefined;
  397. }
  398. /**
  399. * @param {?} parts
  400. * @return {?}
  401. */
  402. function _mergeArrays(parts) {
  403. const /** @type {?} */ result = [];
  404. parts.forEach((part) => part && result.push(...part));
  405. return result;
  406. }
  407. /**
  408. * @fileoverview added by tsickle
  409. * @suppress {checkTypes} checked by tsc
  410. */
  411. /**
  412. * @license
  413. * Copyright Google Inc. All Rights Reserved.
  414. *
  415. * Use of this source code is governed by an MIT-style license that can be
  416. * found in the LICENSE file at https://angular.io/license
  417. */
  418. /**
  419. * A platform that included corePlatform and the compiler.
  420. *
  421. * \@experimental
  422. */
  423. const platformCoreDynamic = createPlatformFactory(platformCore, 'coreDynamic', [
  424. { provide: COMPILER_OPTIONS, useValue: {}, multi: true },
  425. { provide: CompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS] },
  426. ]);
  427. /**
  428. * @fileoverview added by tsickle
  429. * @suppress {checkTypes} checked by tsc
  430. */
  431. class ResourceLoaderImpl extends ResourceLoader {
  432. /**
  433. * @param {?} url
  434. * @return {?}
  435. */
  436. get(url) {
  437. let /** @type {?} */ resolve;
  438. let /** @type {?} */ reject;
  439. const /** @type {?} */ promise = new Promise((res, rej) => {
  440. resolve = res;
  441. reject = rej;
  442. });
  443. const /** @type {?} */ xhr = new XMLHttpRequest();
  444. xhr.open('GET', url, true);
  445. xhr.responseType = 'text';
  446. xhr.onload = function () {
  447. // responseText is the old-school way of retrieving response (supported by IE8 & 9)
  448. // response/responseType properties were introduced in ResourceLoader Level2 spec (supported
  449. // by IE10)
  450. const /** @type {?} */ response = xhr.response || xhr.responseText;
  451. // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
  452. let /** @type {?} */ status = xhr.status === 1223 ? 204 : xhr.status;
  453. // fix status code when it is 0 (0 status is undocumented).
  454. // Occurs when accessing file resources or on Android 4.1 stock browser
  455. // while retrieving files from application cache.
  456. if (status === 0) {
  457. status = response ? 200 : 0;
  458. }
  459. if (200 <= status && status <= 300) {
  460. resolve(response);
  461. }
  462. else {
  463. reject(`Failed to load ${url}`);
  464. }
  465. };
  466. xhr.onerror = function () { reject(`Failed to load ${url}`); };
  467. xhr.send();
  468. return promise;
  469. }
  470. }
  471. ResourceLoaderImpl.decorators = [
  472. { type: Injectable },
  473. ];
  474. /** @nocollapse */
  475. ResourceLoaderImpl.ctorParameters = () => [];
  476. /**
  477. * @fileoverview added by tsickle
  478. * @suppress {checkTypes} checked by tsc
  479. */
  480. /**
  481. * @license
  482. * Copyright Google Inc. All Rights Reserved.
  483. *
  484. * Use of this source code is governed by an MIT-style license that can be
  485. * found in the LICENSE file at https://angular.io/license
  486. */
  487. const INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = [
  488. ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS,
  489. {
  490. provide: COMPILER_OPTIONS,
  491. useValue: { providers: [{ provide: ResourceLoader, useClass: ResourceLoaderImpl, deps: [] }] },
  492. multi: true
  493. },
  494. { provide: PLATFORM_ID, useValue: ɵPLATFORM_BROWSER_ID },
  495. ];
  496. /**
  497. * @fileoverview added by tsickle
  498. * @suppress {checkTypes} checked by tsc
  499. */
  500. /**
  501. * @license
  502. * Copyright Google Inc. All Rights Reserved.
  503. *
  504. * Use of this source code is governed by an MIT-style license that can be
  505. * found in the LICENSE file at https://angular.io/license
  506. */
  507. /**
  508. * An implementation of ResourceLoader that uses a template cache to avoid doing an actual
  509. * ResourceLoader.
  510. *
  511. * The template cache needs to be built and loaded into window.$templateCache
  512. * via a separate mechanism.
  513. */
  514. class CachedResourceLoader extends ResourceLoader {
  515. constructor() {
  516. super();
  517. this._cache = (/** @type {?} */ (ɵglobal)).$templateCache;
  518. if (this._cache == null) {
  519. throw new Error('CachedResourceLoader: Template cache was not found in $templateCache.');
  520. }
  521. }
  522. /**
  523. * @param {?} url
  524. * @return {?}
  525. */
  526. get(url) {
  527. if (this._cache.hasOwnProperty(url)) {
  528. return Promise.resolve(this._cache[url]);
  529. }
  530. else {
  531. return /** @type {?} */ (Promise.reject('CachedResourceLoader: Did not find cached template for ' + url));
  532. }
  533. }
  534. }
  535. /**
  536. * @fileoverview added by tsickle
  537. * @suppress {checkTypes} checked by tsc
  538. */
  539. /**
  540. * @license
  541. * Copyright Google Inc. All Rights Reserved.
  542. *
  543. * Use of this source code is governed by an MIT-style license that can be
  544. * found in the LICENSE file at https://angular.io/license
  545. */
  546. /**
  547. * @fileoverview added by tsickle
  548. * @suppress {checkTypes} checked by tsc
  549. */
  550. /**
  551. * @license
  552. * Copyright Google Inc. All Rights Reserved.
  553. *
  554. * Use of this source code is governed by an MIT-style license that can be
  555. * found in the LICENSE file at https://angular.io/license
  556. */
  557. /**
  558. * \@stable
  559. */
  560. const VERSION = new Version('5.2.11');
  561. /**
  562. * @fileoverview added by tsickle
  563. * @suppress {checkTypes} checked by tsc
  564. */
  565. /**
  566. * @license
  567. * Copyright Google Inc. All Rights Reserved.
  568. *
  569. * Use of this source code is governed by an MIT-style license that can be
  570. * found in the LICENSE file at https://angular.io/license
  571. */
  572. /**
  573. * \@experimental
  574. */
  575. const RESOURCE_CACHE_PROVIDER = [{ provide: ResourceLoader, useClass: CachedResourceLoader, deps: [] }];
  576. /**
  577. * \@stable
  578. */
  579. const platformBrowserDynamic = createPlatformFactory(platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
  580. /**
  581. * @fileoverview added by tsickle
  582. * @suppress {checkTypes} checked by tsc
  583. */
  584. /**
  585. * @license
  586. * Copyright Google Inc. All Rights Reserved.
  587. *
  588. * Use of this source code is governed by an MIT-style license that can be
  589. * found in the LICENSE file at https://angular.io/license
  590. */
  591. /**
  592. * @module
  593. * @description
  594. * Entry point for all public APIs of this package.
  595. */
  596. // This file only reexports content of the `src` folder. Keep it that way.
  597. /**
  598. * @fileoverview added by tsickle
  599. * @suppress {checkTypes} checked by tsc
  600. */
  601. /**
  602. * Generated bundle index. Do not edit.
  603. */
  604. export { VERSION, JitCompilerFactory, RESOURCE_CACHE_PROVIDER, platformBrowserDynamic, CompilerImpl as ɵCompilerImpl, platformCoreDynamic as ɵplatformCoreDynamic, INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS as ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, ResourceLoaderImpl as ɵResourceLoaderImpl, CachedResourceLoader as ɵa };
  605. //# sourceMappingURL=platform-browser-dynamic.js.map