From: Pawel Wasowski Date: Thu, 22 Jun 2017 10:29:13 +0000 (+0200) Subject: [SystemInfo] Fix for "BATTERY" property value change listener callbacks X-Git-Tag: submit/tizen/20170628.112919^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=431444c47e8c19b7765ae2edcf2a37db02bb20b5;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [SystemInfo] Fix for "BATTERY" property value change listener callbacks Callbacks called on "BATTERY" property value change threw an exception, if "lowThreshold" or "highThreshold" SystemInfoOptions were specified. [Verification] Tested in Chrome DevTools, registered callbacks work fine. Change-Id: Ie50dfb0710e9b203e072ff5336b77ff27c464031 Signed-off-by: Pawel Wasowski --- diff --git a/src/systeminfo/systeminfo_api.js b/src/systeminfo/systeminfo_api.js index 2e5dc4fe..bb656c04 100644 --- a/src/systeminfo/systeminfo_api.js +++ b/src/systeminfo/systeminfo_api.js @@ -898,13 +898,13 @@ function _systeminfoBatteryListenerCallback(eventObj) { for (var watchId in callbacks) { if (callbacks.hasOwnProperty(watchId)) { var listener = callbacks[watchId]; + var propObj = !listener.isArrayType ? + _createProperty(property, eventObj.result.array[0]) : + _createPropertyArray(property, eventObj.result); var executeCall = (T_.isUndefined(listener.lowThreshold) || (propObj.level <= listener.lowThreshold)) || (T_.isUndefined(listener.highThreshold) || (propObj.level >= listener.highThreshold)); - var propObj = !listener.isArrayType ? - _createProperty(property, eventObj.result.array[0]) : - _createPropertyArray(property, eventObj.result); if (executeCall) { listener.callback(propObj); }