};
ActivityRecognitionListenerManager.prototype.removeListener = function(watchId) {
- if (this.listeners[watchId] === null || this.listeners[watchId] === undefined) {
- throw new WebAPIException(0, 'Listener id not found.', 'InvalidValuesError');
- }
-
if (this.listeners.hasOwnProperty(watchId)) {
delete this.listeners[watchId];
if (type_.isEmptyObject(this.listeners)) {
setTimeout(function () { native_.callIfPossible(args.errorCallback, native_.getErrorObject(result)); }, 0);
return;
}
- activityRecognitionListener.removeListener(watchId);
+ activityRecognitionListener.removeListener(args.watchId);
};
function StepDifference() {
const auto it = activity_data_.find(watch_id);
- if (activity_data_.end() == it) {
- return LogAndCreateResult( ErrorCode::ABORT_ERR,
- "Listener not found",
- ("Listener with id = %ld not found", watch_id));
+ if (activity_data_.end() != it) {
+ activity_data_.erase(it);
}
- activity_data_.erase(it);
-
return PlatformResult(ErrorCode::NO_ERROR);
}