UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

1 lines • 1.57 kB
{"version":3,"file":"ng-zorro-antd-core-render.mjs","names":[],"sources":["../../components/core/render/after-next-render.ts"],"sourcesContent":["/**\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE\n */\n\nimport { InjectionToken, Injector, afterNextRender, inject } from '@angular/core';\nimport { Observable } from 'rxjs';\n\n/**\n * An injection token representing `afterNextRender` as an observable rather\n * than a callback-based API has been added. This might be necessary in code\n * where streams of data are already being used and we need to wait until\n * the change detection ends before performing any tasks.\n */\nexport const NZ_AFTER_NEXT_RENDER$ = new InjectionToken<Observable<void>>(\n typeof ngDevMode !== 'undefined' && ngDevMode ? 'nz-after-next-render' : '',\n {\n providedIn: 'root',\n factory: () => {\n const injector = inject(Injector);\n\n return new Observable<void>(subscriber => {\n const ref = afterNextRender(\n () => {\n subscriber.next();\n subscriber.complete();\n },\n { injector }\n );\n\n return () => ref.destroy();\n });\n }\n }\n);\n"],"mappings":";;AAcA,MAAa,wBAAwB,IAAI,eACvC,OAAO,cAAc,eAAe,YAAY,yBAAyB,IACzE;CACE,YAAY;CACZ,eAAc;EACZ,MAAM,WAAW,OAAO,QAAQ;EAEhC,OAAO,IAAI,YAAiB,eAAa;GACvC,MAAM,MAAM,sBACL;IACH,WAAW,KAAI;IACf,WAAW,SAAQ;GACrB,GACA,EAAE,SAAQ,CAAE;GAGd,aAAa,IAAI,QAAO;EAC1B,CAAC;CACH;AACD,CAAA"}