From 64ad1c915893fcb27b184326df529715b12ce7bc Mon Sep 17 00:00:00 2001 From: Simon MacDonald Date: Fri, 22 Apr 2016 11:49:46 -0400 Subject: [PATCH] Issue #824: JS error in Success callbackId: PushNotifiation###.. whenever a notification is sent to the device --- www/push.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/www/push.js b/www/push.js index 07895681a..cec36026f 100644 --- a/www/push.js +++ b/www/push.js @@ -190,7 +190,12 @@ PushNotification.prototype.emit = function() { } for (var i = 0, length = this._handlers[eventName].length; i < length; i++) { - this._handlers[eventName][i].apply(undefined,args); + var callback = this._handlers[eventName][i]; + if (typeof callback === 'function') { + callback.apply(undefined,args); + } else { + console.log('event handler: ' + eventName + ' must be a function'); + } } return true;