fix(angular): only bypass zone in high-rate events

fixes #15765
This commit is contained in:
Manu Mtz.-Almeida
2018-10-04 16:53:17 +02:00
parent fe0c3b42ae
commit f63c0f5ccc

View File

@ -16,7 +16,7 @@ export function appInitialize(config: Config) {
Ionic.config = config;
Ionic.ael = (elm, eventName, cb, opts) => {
if (elm.__zone_symbol__addEventListener) {
if (elm.__zone_symbol__addEventListener && skipZone(eventName)) {
elm.__zone_symbol__addEventListener(eventName, cb, opts);
} else {
elm.addEventListener(eventName, cb, opts);
@ -24,7 +24,7 @@ export function appInitialize(config: Config) {
};
Ionic.rel = (elm, eventName, cb, opts) => {
if (elm.__zone_symbol__removeEventListener) {
if (elm.__zone_symbol__removeEventListener && skipZone(eventName)) {
elm.__zone_symbol__removeEventListener(eventName, cb, opts);
} else {
elm.removeEventListener(eventName, cb, opts);
@ -39,10 +39,18 @@ export function appInitialize(config: Config) {
}
};
// define all of Ionic's custom elements
defineCustomElements(win);
}
};
}
const SKIP_ZONE = [
'scroll',
'touchmove',
'mousemove'
];
function skipZone(eventName: string) {
return SKIP_ZONE.indexOf(eventName) >= 0;
}