UNPKG

@nguniversal/module-map-ngfactory-loader

Version:

NgFactoryLoader which uses a Map to load ngfactories without lazy loading

23 lines 2.06 kB
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("tslib"),require("@angular/core")):"function"==typeof define&&define.amd?define("@nguniversal/module-map-ngfactory-loader",["exports","tslib","@angular/core"],o):o(((e=e||self).nguniversal=e.nguniversal||{},e.nguniversal.moduleMapNgfactoryLoader={}),e.tslib,e.ng.core)}(this,function(e,o,r){"use strict";var t=new r.InjectionToken("MODULE_MAP"),n=function(){function e(e,o){this.compiler=e,this.moduleMap=o}return e.prototype.load=function(e){var o=this.compiler instanceof r.Compiler,t=this.moduleMap[e];if(!t)throw new Error(e+" did not exist in the MODULE_MAP");return o?this.loadFactory(t):this.loadAndCompile(t)},e.prototype.loadFactory=function(e){return new Promise(function(o){return o(e)})},e.prototype.loadAndCompile=function(e){return this.compiler.compileModuleAsync(e)},o.__decorate([r.Injectable(),o.__param(1,r.Inject(t)),o.__metadata("design:paramtypes",[r.Compiler,Object])],e)}(),i=function(){function e(){}var i;return i=e,e.withMap=function(e){return{ngModule:i,providers:[{provide:t,useValue:e}]}},i=o.__decorate([r.NgModule({providers:[{provide:r.NgModuleFactoryLoader,useClass:n}]})],e)}(); /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ e.provideModuleMap=function a(e){return{provide:t,useValue:e}},e.ModuleMapLoaderModule=i,e.MODULE_MAP=t,e.ModuleMapNgFactoryLoader=n,Object.defineProperty(e,"__esModule",{value:!0})});