mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix: convert property bag to args
This commit is contained in:
@@ -290,7 +290,9 @@ export class DOMEvent implements Event {
|
||||
* event's cancelable attribute value is false or its preventDefault()
|
||||
* method was not invoked, and false otherwise.
|
||||
*/
|
||||
dispatchTo({ target, data, getGlobalEventHandlersPreHandling, getGlobalEventHandlersPostHandling }: { target: Observable; data: EventData; getGlobalEventHandlersPreHandling?: () => MutationSensitiveArray<ListenerEntry>; getGlobalEventHandlersPostHandling?: () => MutationSensitiveArray<ListenerEntry> }): boolean {
|
||||
// Taking multiple params rather than a single property bag saves about 100
|
||||
// nanoseconds per call.
|
||||
dispatchTo(target: Observable, data: EventData, getGlobalEventHandlersPreHandling?: () => MutationSensitiveArray<ListenerEntry>, getGlobalEventHandlersPostHandling?: () => MutationSensitiveArray<ListenerEntry>): boolean {
|
||||
if (this.eventPhase !== DOMEvent.NONE) {
|
||||
throw new Error('Tried to dispatch a dispatching event');
|
||||
}
|
||||
|
||||
@@ -377,12 +377,12 @@ export class Observable implements EventTarget {
|
||||
* @param options Options for the event, in line with DOM Standard.
|
||||
*/
|
||||
public notify<T extends EventData>(data: T, options?: CustomEventInit): void {
|
||||
new DOMEvent(data.eventName, options).dispatchTo({
|
||||
target: this,
|
||||
new DOMEvent(data.eventName, options).dispatchTo(
|
||||
this,
|
||||
data,
|
||||
getGlobalEventHandlersPreHandling: () => this._getGlobalEventHandlers(data, 'First'),
|
||||
getGlobalEventHandlersPostHandling: () => this._getGlobalEventHandlers(data, ''),
|
||||
});
|
||||
() => this._getGlobalEventHandlers(data, 'First'),
|
||||
() => this._getGlobalEventHandlers(data, '')
|
||||
);
|
||||
}
|
||||
|
||||
dispatchEvent(event: DOMEvent): boolean {
|
||||
@@ -392,12 +392,12 @@ export class Observable implements EventTarget {
|
||||
detail: event.detail,
|
||||
};
|
||||
|
||||
return event.dispatchTo({
|
||||
target: this,
|
||||
return event.dispatchTo(
|
||||
this,
|
||||
data,
|
||||
getGlobalEventHandlersPreHandling: () => this._getGlobalEventHandlers(data, 'First'),
|
||||
getGlobalEventHandlersPostHandling: () => this._getGlobalEventHandlers(data, ''),
|
||||
});
|
||||
() => this._getGlobalEventHandlers(data, 'First'),
|
||||
() => this._getGlobalEventHandlers(data, '')
|
||||
);
|
||||
}
|
||||
|
||||
private _getGlobalEventHandlers(data: EventData, eventType: 'First' | ''): MutationSensitiveArray<ListenerEntry> {
|
||||
|
||||
Reference in New Issue
Block a user