diff --git a/frameworks/emitter/ani/ets/@ohos.events.emitter.ets b/frameworks/emitter/ani/ets/@ohos.events.emitter.ets index b024039cf90bfa1326e92b7609478ce43c945aaa..237a092b51afb1019298cb12bc084ba786ab2eb7 100644 --- a/frameworks/emitter/ani/ets/@ohos.events.emitter.ets +++ b/frameworks/emitter/ani/ets/@ohos.events.emitter.ets @@ -78,7 +78,7 @@ namespace emitter { export native function EmitStringOptionsGenericSync(eventId: string, options: Options, data: GenericEventData): void; export native function EmitStringOptionsSync(eventId:string, options: Options): void; - export function on(event: InnerEvent, callback: Callback): void { + export function on_chinast_1(event: InnerEvent, callback: Callback): void { if (event == null || callback == null) { return; } @@ -87,7 +87,7 @@ namespace emitter { } } - export function once(event: InnerEvent, callback: Callback): void { + export function once_chinast_1(event: InnerEvent, callback: Callback): void { if (event == null || callback == null) { return; } @@ -96,35 +96,37 @@ namespace emitter { } } - export function on(eventId: string, callback: Callback): void { + export function on_chinast_2(eventId: string, callback: Callback): void { if (eventId === '' || callback == null) { return; } emitter.OnOrOnceStringSync(eventId, false, callback, "eventData"); } - export function once(eventId: string, callback: Callback): void { + export function once_chinast_2(eventId: string, callback: Callback): void { if (eventId === '' || callback == null) { return; } OnOrOnceStringSync(eventId, true, callback, "eventData"); } - export function off(eventId: string): void { + overload once { once_chinast_1, once_chinast_2 }; + + export function off_chinast_1(eventId: string): void { if (eventId === '') { return; } OffStringIdSync(eventId); } - export function off(eventId: string, callback: Callback): void { + export function off_chinast_2(eventId: string, callback: Callback): void { if (eventId === '' || callback == null) { return; } emitter.OffStringSync(eventId, callback); } - export function off(eventId: string, callback: Callback | Callback>): void { + export function off_chinast_3(eventId: string, callback: Callback | Callback>): void { if (eventId === '' || callback == null) { return; } @@ -135,18 +137,20 @@ namespace emitter { } } - export function off(eventId: number): void { + export function off_chinast_4(eventId: number): void { OffNumberSync(eventId); } - export function off(eventId: number, callback: Callback): void { + export function off_chinast_5(eventId: number, callback: Callback): void { if (callback == null) { return; } OffNumberCallbackSync(eventId, callback); } - export function on(eventId: string, callback: Callback | Callback>): void { + overload off { off_chinast_1, off_chinast_2, off_chinast_3, off_chinast_4, off_chinast_5 }; + + export function on_chinast_3(eventId: string, callback: Callback | Callback>): void { if (eventId === '' || callback == null) { return; } @@ -157,7 +161,9 @@ namespace emitter { } } - export function emit(eventId: string, options: Options, data?: EventData): void { + overload on { on_chinast_1, on_chinast_2, on_chinast_3 }; + + export function emit_chinast_1(eventId: string, options: Options, data?: EventData): void { if (eventId === '' || options == null) { return; } @@ -168,7 +174,7 @@ namespace emitter { } } - export function emit(eventId: string, options: Options, data?: GenericEventData): void { + export function emit_chinast_2(eventId: string, options: Options, data?: GenericEventData): void { if (eventId === '' || options == null) { return; } @@ -179,7 +185,7 @@ namespace emitter { } } - export function emit(eventId: string, data?: EventData): void { + export function emit_chinast_3(eventId: string, data?: EventData): void { if (eventId === '') { return; } @@ -190,7 +196,7 @@ namespace emitter { } } - export function emit(eventId: string, data?: GenericEventData): void { + export function emit_chinast_4(eventId: string, data?: GenericEventData): void { if (eventId === '') { return; } @@ -201,7 +207,7 @@ namespace emitter { } } - export function emit(event: InnerEvent, data?: EventData): void { + export function emit_chinast_5(event: InnerEvent, data?: EventData): void { if (event == null) { return; } @@ -212,6 +218,8 @@ namespace emitter { } } + overload emit { emit_chinast_1, emit_chinast_2, emit_chinast_3, emit_chinast_4, emit_chinast_5 }; + export function getListenerCount(eventId: number | string): number { let count : number = 0; if (typeof eventId === "number") {