Created
December 26, 2022 13:00
-
-
Save e-oz/aa02d77e4514de9651ad8fd57023fa4c to your computer and use it in GitHub Desktop.
NgZone optimisations for Angular CDK Drag & Drop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
platformBrowserDynamic().bootstrapModule(AppModule, { | |
ngZoneEventCoalescing: true, | |
ngZoneRunCoalescing: true, | |
}).catch((err) => console.error(err)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import '@angular/localize/init'; | |
import './zone-flags'; | |
import 'zone.js'; | |
import 'zone.js/plugins/zone-patch-rxjs'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable @typescript-eslint/no-explicit-any */ | |
// | |
// https://angular.io/guide/zone#setting-up-zonejs | |
// https://github.com/angular/angular/blob/master/packages/zone.js/lib/zone.configurations.api.ts | |
// | |
(window as any).__Zone_disable_defineProperty = true; | |
(window as any).__Zone_disable_requestAnimationFrame = true; | |
(window as any).__Zone_disable_on_property = true; | |
(window as any).__zone_symbol__UNPATCHED_EVENTS = [ | |
'blur', 'focus', | |
'drag', 'dragend', 'dragenter', 'dragleave', 'dragover', 'dragstart', | |
'durationchange', | |
'emptied', | |
'mouseenter', // needed for mat-tooltip (if no zone-rxjs patch) | |
'mouseleave', // needed for mat-tooltip (if no zone-rxjs patch) | |
'mouseout', | |
'mousemove', // needed for mat-slider (if no zone-rxjs patch) | |
'mouseover', | |
'scroll', | |
'mousewheel', | |
'ratechange', 'timeupdate', 'waiting', 'touchmove', | |
'mozpointerlockchange', 'mozpointerlockerror' | |
]; | |
(window as any).__Zone_disable_EventEmitter = true; | |
(window as any).__Zone_disable_nextTick = true; | |
(window as any).__Zone_disable_fs = true; | |
(window as any).__Zone_disable_node_timers = true; | |
(window as any).__Zone_disable_crypto = true; | |
(window as any).__Zone_disable_blocking = true; | |
// (window as any).__Zone_disable_EventTarget = true; | |
(window as any).__Zone_disable_FileReader = true; | |
(window as any).__Zone_disable_MutationObserver = true; | |
(window as any).__Zone_disable_IntersectionObserver = true; | |
(window as any).__Zone_disable_customElements = true; | |
(window as any).__Zone_disable_XHR = true; | |
(window as any).__Zone_disable_geolocation = true; | |
(window as any).__Zone_disable_canvas = true; | |
try { | |
if (window?.location?.hostname !== 'localhost') { | |
(window as any).__zone_symbol__DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION = true; | |
(window as any).__zone_symbol__ignoreConsoleErrorUncaughtError = true; | |
} | |
} catch (e) { | |
console.error(e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment