浏览代码

Hotfix: device plugin isnt available before the onCordovaInfoReady event. (Fixes #126)

Sebastián Katzer 11 年之前
父节点
当前提交
5afa40a838
共有 1 个文件被更改,包括 12 次插入12 次删除
  1. 12 12
      www/local-notification.js

+ 12 - 12
www/local-notification.js

@@ -208,26 +208,26 @@ LocalNotification.prototype = {
 var plugin  = new LocalNotification(),
     channel = require('cordova/channel');
 
-channel.onCordovaReady.subscribe( function () {
-    plugin.applyPlatformSpecificOptions();
-});
-
 channel.deviceready.subscribe( function () {
     cordova.exec(null, null, 'LocalNotification', 'deviceready', []);
 });
 
 channel.onCordovaReady.subscribe( function () {
-    if (device.platform != 'iOS') {
-        channel.onPause.subscribe( function () {
-            cordova.exec(null, null, 'LocalNotification', 'pause', []);
-        });
+    channel.onCordovaInfoReady.subscribe( function () {
+        if (device.platform != 'iOS') {
+            channel.onPause.subscribe( function () {
+                cordova.exec(null, null, 'LocalNotification', 'pause', []);
+            });
+
+            channel.onResume.subscribe( function () {
+                cordova.exec(null, null, 'LocalNotification', 'resume', []);
+            });
 
-        channel.onResume.subscribe( function () {
             cordova.exec(null, null, 'LocalNotification', 'resume', []);
-        });
+        }
 
-        cordova.exec(null, null, 'LocalNotification', 'resume', []);
-    }
+        plugin.applyPlatformSpecificOptions();
+    });
 });
 
 module.exports = plugin;