From: ws29.jung Date: Wed, 12 Aug 2020 06:14:55 +0000 (+0900) Subject: [Addon] Fix argument passing to EventEmitter X-Git-Tag: accepted/tizen/unified/20200826.133035^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=583a291e72e2ac3db1945c5a5570077b57227387;p=platform%2Fframework%2Fweb%2Fwrtjs.git [Addon] Fix argument passing to EventEmitter When function argument list '...args' is handled as 'args, it is no longer can be used as multiple argument list but a single object. To keep and pass same argument list through Emitter functions, inappropariate use of 'args' is now changed to '...args'. Change-Id: Ia978fbfd9aa337d027442813c04808e903b5bd12 Signed-off-by: ws29.jung --- diff --git a/wrt_app/src/addon_manager.ts b/wrt_app/src/addon_manager.ts index c4f1b66..de7a845 100644 --- a/wrt_app/src/addon_manager.ts +++ b/wrt_app/src/addon_manager.ts @@ -65,7 +65,7 @@ class AddonEventManager { private listeners = new Map(); private bindListener = (listener: (...args: any[]) => void, addon: AddonInfo): (...args: any[]) => void => { return (...args) => { - listener.call(addon.module, args); + listener.call(addon.module, ...args); } } on = (eventName: string, listener: (...args: any[]) => void, addon: AddonInfo): void => { @@ -115,7 +115,7 @@ class AddonEventManager { } } emit = (eventName: string, ...args: any[]): void => { - this.emitter.emit(eventName, args); + this.emitter.emit(eventName, ...args); } } @@ -240,7 +240,7 @@ class AddonManager { } emit(eventName: string, ...args: any[]) { - this.eventManager.emit(eventName, args); + this.eventManager.emit(eventName, ...args); } checkAddon(appPath: string) {