mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
fix(raf): test for undefined raf
When in a headless environment RAF may not be defined so we need to return the polyfilled version rather than letting the undefined function be called.
This commit is contained in:
@ -25,7 +25,9 @@
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
// use native raf rather than the zone wrapped one
|
// use native raf rather than the zone wrapped one
|
||||||
export const nativeRaf = (window[window['Zone']['__symbol__']('requestAnimationFrame')] || window[window['Zone']['__symbol__']('webkitRequestAnimationFrame')])['bind'](window);
|
let originalRaf = (window[window['Zone']['__symbol__']('requestAnimationFrame')] || window[window['Zone']['__symbol__']('webkitRequestAnimationFrame')]);
|
||||||
|
// if the originalRaf from the Zone symbol is not available, we need to provide the polyfilled version
|
||||||
|
export const nativeRaf = originalRaf !== undefined ? originalRaf['bind'](window) : window.requestAnimationFrame.bind(window);
|
||||||
|
|
||||||
// zone wrapped raf
|
// zone wrapped raf
|
||||||
export const raf = window.requestAnimationFrame.bind(window);
|
export const raf = window.requestAnimationFrame.bind(window);
|
||||||
|
Reference in New Issue
Block a user