Sfoglia il codice sorgente

Check if function is provided

Sebastián Katzer 10 anni fa
parent
commit
3afb598550
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      www/local-notification-core.js

+ 3 - 0
www/local-notification-core.js

@@ -441,6 +441,9 @@ exports.registerPermission = function (callback, scope) {
  */
 exports.on = function (event, callback, scope) {
 
+    if (typeof callback !== "function")
+        return;
+
     if (!this._listener[event]) {
         this._listener[event] = [];
     }