ng-zorro-antd-core-render.mjs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { InjectionToken, inject, Injector, afterNextRender } from '@angular/core';
  2. import { Observable } from 'rxjs';
  3. /**
  4. * Use of this source code is governed by an MIT-style license that can be
  5. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  6. */
  7. /**
  8. * An injection token representing `afterNextRender` as an observable rather
  9. * than a callback-based API has been added. This might be necessary in code
  10. * where streams of data are already being used and we need to wait until
  11. * the change detection ends before performing any tasks.
  12. */
  13. const NZ_AFTER_NEXT_RENDER$ = new InjectionToken('nz-after-next-render', {
  14. providedIn: 'root',
  15. factory: () => {
  16. const injector = inject(Injector);
  17. return new Observable(subscriber => {
  18. const ref = afterNextRender(() => {
  19. subscriber.next();
  20. subscriber.complete();
  21. }, { injector });
  22. return () => ref.destroy();
  23. });
  24. }
  25. });
  26. /**
  27. * Use of this source code is governed by an MIT-style license that can be
  28. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  29. */
  30. /**
  31. * Generated bundle index. Do not edit.
  32. */
  33. export { NZ_AFTER_NEXT_RENDER$ };
  34. //# sourceMappingURL=ng-zorro-antd-core-render.mjs.map