Quellcode durchsuchen

Check if function is provided

Sebastián Katzer vor 10 Jahren
Ursprung
Commit
3afb598550
1 geänderte Dateien mit 3 neuen und 0 gelöschten Zeilen
  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] = [];
     }