mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(core): implement EventListenerOptions for addEventListener and removeEventListener
This commit is contained in:
@@ -17,10 +17,10 @@ export abstract class ScrollViewBase extends ContentView implements ScrollViewDe
|
||||
|
||||
private _addedScrollEvent = false;
|
||||
|
||||
public addEventListener(arg: string, callback: (data: EventData) => void, thisArg?: any): void {
|
||||
public addEventListener(arg: string, callback: (data: EventData) => void, options?: AddEventListenerOptions | boolean, thisArg?: any): void {
|
||||
const hasExistingScrollListeners: boolean = this.hasListeners(ScrollViewBase.scrollEvent);
|
||||
|
||||
super.addEventListener(arg, callback, thisArg);
|
||||
super.addEventListener(arg, callback, options, thisArg);
|
||||
|
||||
// This indicates that a scroll listener was added for first time
|
||||
if (!hasExistingScrollListeners && this.hasListeners(ScrollViewBase.scrollEvent)) {
|
||||
@@ -32,10 +32,10 @@ export abstract class ScrollViewBase extends ContentView implements ScrollViewDe
|
||||
}
|
||||
}
|
||||
|
||||
public removeEventListener(arg: string, callback?: (data: EventData) => void, thisArg?: any): void {
|
||||
public removeEventListener(arg: string, callback?: (data: EventData) => void, options?: EventListenerOptions | boolean, thisArg?: any): void {
|
||||
const hasExistingScrollListeners: boolean = this.hasListeners(ScrollViewBase.scrollEvent);
|
||||
|
||||
super.removeEventListener(arg, callback, thisArg);
|
||||
super.removeEventListener(arg, callback, options, thisArg);
|
||||
|
||||
// This indicates that the final scroll listener was removed
|
||||
if (hasExistingScrollListeners && !this.hasListeners(ScrollViewBase.scrollEvent)) {
|
||||
|
||||
Reference in New Issue
Block a user