static-injector 6.2.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/import/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export * from './error_handler';
24
24
  export * from './pending_tasks';
25
25
  export * from './linker/destroy_ref';
26
26
  export { StaticProvider } from './di/interface/provider';
27
+ export { EffectScheduler } from './render3/reactivity/root_effect_scheduler';
27
28
  export declare function Injectable(args?: any): (constructor: Function) => void;
28
29
  export declare class StaticInjectOptions {
29
30
  static injectOptions: Parameters<InjectableDecorator>[0];
package/index.js CHANGED
@@ -24,6 +24,7 @@ __export(import_exports, {
24
24
  ChangeDetectionSchedulerImpl: () => ChangeDetectionSchedulerImpl,
25
25
  DecoratorFlags: () => DecoratorFlags,
26
26
  DestroyRef: () => DestroyRef,
27
+ EffectScheduler: () => EffectScheduler,
27
28
  EnvironmentInjector: () => EnvironmentInjector,
28
29
  ErrorHandler: () => ErrorHandler,
29
30
  INJECTOR_SCOPE: () => INJECTOR_SCOPE,
@@ -1707,32 +1708,11 @@ function createEffectFn(node, fn) {
1707
1708
  }
1708
1709
 
1709
1710
  // src/import/util/callback_scheduler.ts
1710
- function scheduleCallbackWithRafRace(callback) {
1711
- let timeoutId;
1712
- let animationFrameId;
1713
- function cleanup() {
1711
+ function scheduleCallbackWithMicrotask(callback) {
1712
+ queueMicrotask(() => callback());
1713
+ return () => {
1714
1714
  callback = noop;
1715
- try {
1716
- if (animationFrameId !== void 0 && typeof cancelAnimationFrame === "function") {
1717
- cancelAnimationFrame(animationFrameId);
1718
- }
1719
- if (timeoutId !== void 0) {
1720
- clearTimeout(timeoutId);
1721
- }
1722
- } catch {
1723
- }
1724
- }
1725
- timeoutId = setTimeout(() => {
1726
- callback();
1727
- cleanup();
1728
- });
1729
- if (typeof requestAnimationFrame === "function") {
1730
- animationFrameId = requestAnimationFrame(() => {
1731
- callback();
1732
- cleanup();
1733
- });
1734
- }
1735
- return () => cleanup();
1715
+ };
1736
1716
  }
1737
1717
 
1738
1718
  // src/import/change_detection/scheduling/zoneless_scheduling_impl.ts
@@ -1741,8 +1721,10 @@ var ChangeDetectionSchedulerImpl = class {
1741
1721
  #rootEffectScheduler = inject2(EffectScheduler);
1742
1722
  cancelScheduledCallback = null;
1743
1723
  notify(source) {
1744
- this.cancelScheduledCallback = scheduleCallbackWithRafRace(() => {
1724
+ this.cancelScheduledCallback = scheduleCallbackWithMicrotask(() => {
1725
+ this.runningTick = true;
1745
1726
  this.#rootEffectScheduler.flush();
1727
+ this.cleanup();
1746
1728
  });
1747
1729
  }
1748
1730
  cleanup() {
@@ -2185,6 +2167,7 @@ function createRootInjector(options) {
2185
2167
  ChangeDetectionSchedulerImpl,
2186
2168
  DecoratorFlags,
2187
2169
  DestroyRef,
2170
+ EffectScheduler,
2188
2171
  EnvironmentInjector,
2189
2172
  ErrorHandler,
2190
2173
  INJECTOR_SCOPE,