Skip to content

Instantly share code, notes, and snippets.

@manekinekko
Created February 3, 2021 09:37
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save manekinekko/590bd5d19400e740ba72e606f0c8d3f1 to your computer and use it in GitHub Desktop.
Save manekinekko/590bd5d19400e740ba72e606f0c8d3f1 to your computer and use it in GitHub Desktop.
Reduce overhead introduced by the Zone.js
// Reduce overhead introduced by the Zone.js:
// by Wassim Chegham (@manekinekko)
// Instructions:
// 1. Add this config in a different file, eg. zone-flags.ts
// 2. make sure to check that your app is not relying on an API before disabling it!!!
// 3. import ./zone-flags.ts in polyfills.ts
// Not needed for morst of Angular apps
(window as any).__Zone_disable_requestAnimationFrame = true;
(window as any).__Zone_disable_canvas = true;
(window as any).__Zone_disable_Error = true;
(window as any).__Zone_disable_geolocation = true;
(window as any).__Zone_disable_toString = true;
(window as any).__Zone_disable_blocking = true;
(window as any).__Zone_disable_PromiseRejectionEvent = true;
(window as any).__Zone_disable_MutationObserver = true;
(window as any).__Zone_disable_Intersection = true;
(window as any).__Zone_disable_FileReader = true;
(window as any).__Zone_disable_IE_check = true;
(window as any).__Zone_disable_geolocation = true;
(window as any).__Zone_disable_mediaQuery = true;
(window as any).__Zone_disable_notification = true;
(window as any).__Zone_disable_MessagePort = true;
(window as any).__zone_symbol__UNPATCHED_EVENTS = ["scroll", "mousemove"];
(window as any).__Zone_enable_cross_context_check = false;
// Optional for some Angular apps
(window as any).__Zone_disable_timers = true;
(window as any).__Zone_disable_XHR = true;
(window as any).__Zone_disable_on_property = true;
// Needed for all Angular apps
(window as any).__Zone_disable_ZoneAwarePromise = false;
(window as any).__Zone_disable_EventTarget = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment