[widgetservice][utils] Common implementation for ListenerManager. 12/196112/6
authorMichal Michalski <m.michalski2@partner.samsung.com>
Fri, 21 Dec 2018 19:35:17 +0000 (20:35 +0100)
committerMichal Michalski <m.michalski2@partner.samsung.com>
Thu, 3 Jan 2019 12:38:40 +0000 (13:38 +0100)
commitce560f81daf327fdcbd585810d3492d8dc8bce38
tree0334930b9cb235a403b187684dd5b8471757d295
parent3ebae4da0465b0857c714e32d103511978d6df03
[widgetservice][utils] Common implementation for ListenerManager.

I extracted broken ListenerManager implementation from widgetservice module
fixed it, and placed it inside utils_api.js module as CommonListenerManager.
This implementation has customizable behavior if removeListener cannot find
listener for given id, so you can throw exception, do nothing, or return
error object.

[Verification]

Test usage of this CommonListenerManager implementation is provided in this
commit using widgetservice widgetStateChangeListener which I replaced.
Manual tests were performed to verify that the implementation behaves as
expected.

Change-Id: I0e18e091b9ad8cacc685663c65f3358cc022188d
src/utils/utils_api.js
src/widgetservice/widgetservice_api.js