mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix: determine insertion function up-front
This commit is contained in:
@@ -208,9 +208,13 @@ export class DOMEvent implements Event {
|
|||||||
return recycledEventPath;
|
return recycledEventPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determining the function up-front (rather than inside the loop) saves
|
||||||
|
// 50 nanoseconds per dispatchTo() call.
|
||||||
|
const insert = path === 'capture' ? recycledEventPath.unshift.bind(recycledEventPath) : recycledEventPath.push.bind(recycledEventPath);
|
||||||
|
|
||||||
let nextResponder = responder.parent;
|
let nextResponder = responder.parent;
|
||||||
while (nextResponder) {
|
while (nextResponder) {
|
||||||
path === 'capture' ? recycledEventPath.unshift(nextResponder) : recycledEventPath.push(nextResponder);
|
insert(nextResponder);
|
||||||
|
|
||||||
// TODO: decide whether to walk up from Page to Frame, and whether
|
// TODO: decide whether to walk up from Page to Frame, and whether
|
||||||
// to then walk from Frame to Application or something.
|
// to then walk from Frame to Application or something.
|
||||||
|
|||||||
Reference in New Issue
Block a user