Explorar o código

Zusätzlichen Success-Handler hinzugefügt, um die Foreground/Background Callbacks aufzurufen zu können

Sebastián Katzer %!s(int64=12) %!d(string=hai) anos
pai
achega
864d5d2ed9
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      www/local-notification.js

+ 7 - 1
www/local-notification.js

@@ -30,6 +30,12 @@ LocalNotification.prototype = {
             foreground: ''
         };
 
+        var callbackFn = function (callbackName, id) {
+            if (callbackName) {
+                eval(callbackName + '(' + id + ')');
+            }
+        };
+
         for (var key in defaults) {
             if (options[key] !== undefined) {
                 defaults[key] = options[key];
@@ -40,7 +46,7 @@ LocalNotification.prototype = {
             defaults.date = Math.round(defaults.date.getTime()/1000);
         }
 
-        cordova.exec(null, null, 'LocalNotification','add', [defaults]);
+        cordova.exec(callbackFn, null, 'LocalNotification', 'add', [defaults]);
 
         return defaults.id;
     },