Allow features/modules to initialize code before deviceready fires. CupcakeLocalStorage uses this capability to delay deviceready until local storage has been read and inited.

This commit is contained in:
Bryce Curtis
2011-01-06 22:50:13 -06:00
parent 8d513e2765
commit 023df10f31
2 changed files with 59 additions and 2 deletions
+2
View File
@@ -309,6 +309,7 @@ var CupcakeLocalStorage = function() {
for(var i = 0; i < result.rows.length; i++) {
storage[result.rows.item(i)['id']] = result.rows.item(i)['body'];
}
PhoneGap.initializationComplete("cupcakeStorage");
});
},
@@ -356,6 +357,7 @@ PhoneGap.addConstructor(function() {
if (typeof window.localStorage == "undefined") {
navigator.localStorage = window.localStorage = new CupcakeLocalStorage();
PhoneGap.waitForInitialization("cupcakeStorage");
}
});