UNPKG

@ngx-ssr/platform

Version:

Install package

78 lines (71 loc) 4.3 kB
import * as i0 from '@angular/core'; import { InjectionToken, inject, PLATFORM_ID, Directive, Inject, NgModule } from '@angular/core'; import { isPlatformServer, isPlatformBrowser, CommonModule } from '@angular/common'; const IS_SERVER_PLATFORM = new InjectionToken('Is server?', { factory() { const platform = inject(PLATFORM_ID); return isPlatformServer(platform); }, }); const IS_BROWSER_PLATFORM = new InjectionToken('Is browser?', { factory() { const platform = inject(PLATFORM_ID); return isPlatformBrowser(platform); }, }); class IfIsServerDirective { constructor(isServer, templateRef, viewContainer) { if (isServer) { viewContainer.createEmbeddedView(templateRef); } } } IfIsServerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.8", ngImport: i0, type: IfIsServerDirective, deps: [{ token: IS_SERVER_PLATFORM }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); IfIsServerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.8", type: IfIsServerDirective, selector: "[ifIsServer]", ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.8", ngImport: i0, type: IfIsServerDirective, decorators: [{ type: Directive, args: [{ // eslint-disable-next-line @angular-eslint/directive-selector selector: '[ifIsServer]', }] }], ctorParameters: function () { return [{ type: undefined, decorators: [{ type: Inject, args: [IS_SERVER_PLATFORM] }] }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; } }); class IfIsBrowserDirective { constructor(isBrowser, templateRef, viewContainer) { if (isBrowser) { viewContainer.createEmbeddedView(templateRef); } } } IfIsBrowserDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.8", ngImport: i0, type: IfIsBrowserDirective, deps: [{ token: IS_BROWSER_PLATFORM }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); IfIsBrowserDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.8", type: IfIsBrowserDirective, selector: "[ifIsBrowser]", ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.8", ngImport: i0, type: IfIsBrowserDirective, decorators: [{ type: Directive, args: [{ // eslint-disable-next-line @angular-eslint/directive-selector selector: '[ifIsBrowser]', }] }], ctorParameters: function () { return [{ type: undefined, decorators: [{ type: Inject, args: [IS_BROWSER_PLATFORM] }] }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; } }); class NgxSsrPlatformModule { } NgxSsrPlatformModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.8", ngImport: i0, type: NgxSsrPlatformModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); NgxSsrPlatformModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.8", ngImport: i0, type: NgxSsrPlatformModule, declarations: [IfIsBrowserDirective, IfIsServerDirective], imports: [CommonModule], exports: [IfIsBrowserDirective, IfIsServerDirective] }); NgxSsrPlatformModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.8", ngImport: i0, type: NgxSsrPlatformModule, imports: [[CommonModule]] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.8", ngImport: i0, type: NgxSsrPlatformModule, decorators: [{ type: NgModule, args: [{ imports: [CommonModule], declarations: [IfIsBrowserDirective, IfIsServerDirective], exports: [IfIsBrowserDirective, IfIsServerDirective], }] }] }); /** * Generated bundle index. Do not edit. */ export { IS_BROWSER_PLATFORM, IS_SERVER_PLATFORM, IfIsBrowserDirective, IfIsServerDirective, NgxSsrPlatformModule }; //# sourceMappingURL=ngx-ssr-platform.js.map