Przeglądaj źródła

Allow to manually fire queued events [fixes #1444]

Sebastián Katzer 7 lat temu
rodzic
commit
d6e739abc5
1 zmienionych plików z 12 dodań i 1 usunięć
  1. 12 1
      www/local-notification.js

+ 12 - 1
www/local-notification.js

@@ -503,6 +503,15 @@ exports.fireEvent = function (event) {
     }
 };
 
+/**
+ * Fire queued events once the device is ready and all listeners are registered.
+ *
+ * @return [ Void ]
+ */
+exports.fireQueuedEvents = function() {
+    exports._exec('ready');
+};
+
 /**
  * Merge custom properties with the default values.
  *
@@ -957,7 +966,9 @@ if (!Array.from) {
 
 // Called after 'deviceready' event
 channel.deviceready.subscribe(function () {
-    exports._exec('ready');
+    if (!window.skipLocalNotificationReady) {
+        exports.fireQueuedEvents();
+    }
 });
 
 // Called before 'deviceready' event