mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix: apply -> call
This commit is contained in:
@@ -418,7 +418,11 @@ export class DOMEvent implements Event {
|
|||||||
|
|
||||||
// Consistent with the original implementation, we only apply
|
// Consistent with the original implementation, we only apply
|
||||||
// context to the function if thisArg is truthy.
|
// context to the function if thisArg is truthy.
|
||||||
const returnValue = callback.apply(thisArg || undefined, [data]);
|
//
|
||||||
|
// We prefer Function.call() over Function.apply() as it avoids
|
||||||
|
// having to allocate an array just to hold the args (saves 30
|
||||||
|
// nanoseconds per dispatchTo() call).
|
||||||
|
const returnValue = callback.call(thisArg || undefined, data);
|
||||||
|
|
||||||
// This ensures that errors thrown inside asynchronous functions do
|
// This ensures that errors thrown inside asynchronous functions do
|
||||||
// not get swallowed.
|
// not get swallowed.
|
||||||
|
|||||||
Reference in New Issue
Block a user