@@ -35,29 +35,20 @@ import {global} from './global';
3535 * @returns a function to cancel the scheduled callback
3636 */
3737export function scheduleCallback ( callback : Function ) : ( ) => void {
38- // Note: the `getNativeRequestAnimationFrame ` is used in the `NgZone` class, but we cannot use the
38+ // Note: the `scheduleCallback ` is used in the `NgZone` class, but we cannot use the
3939 // `inject` function. The `NgZone` instance may be created manually, and thus the injection
4040 // context will be unavailable. This might be enough to check whether `requestAnimationFrame` is
4141 // available because otherwise, we'll fall back to `setTimeout`.
4242 const hasRequestAnimationFrame = typeof global [ 'requestAnimationFrame' ] === 'function' ;
4343 let nativeRequestAnimationFrame =
4444 hasRequestAnimationFrame ? global [ 'requestAnimationFrame' ] : null ;
4545 let nativeSetTimeout = global [ 'setTimeout' ] ;
46-
4746 if ( typeof Zone !== 'undefined' ) {
48- // Note: zone.js sets original implementations on patched APIs behind the
49- // `__zone_symbol__OriginalDelegate` key (see `attachOriginToPatched`). Given the following
50- // example: `window.requestAnimationFrame.__zone_symbol__OriginalDelegate`; this would return an
51- // unpatched implementation of the `requestAnimationFrame`, which isn't intercepted by the
52- // Angular zone. We use the unpatched implementation to avoid another change detection when
53- // coalescing tasks.
54- const ORIGINAL_DELEGATE_SYMBOL = ( Zone as any ) . __symbol__ ( 'OriginalDelegate' ) ;
55- if ( nativeRequestAnimationFrame ) {
47+ if ( hasRequestAnimationFrame ) {
5648 nativeRequestAnimationFrame =
57- ( nativeRequestAnimationFrame as any ) [ ORIGINAL_DELEGATE_SYMBOL ] ??
58- nativeRequestAnimationFrame ;
49+ global [ Zone . __symbol__ ( 'requestAnimationFrame' ) ] ?? nativeRequestAnimationFrame ;
5950 }
60- nativeSetTimeout = ( nativeSetTimeout as any ) [ ORIGINAL_DELEGATE_SYMBOL ] ?? nativeSetTimeout ;
51+ nativeSetTimeout = global [ Zone . __symbol__ ( 'setTimeout' ) ] ?? nativeSetTimeout ;
6152 }
6253
6354 let executeCallback = true ;
0 commit comments