Can I listen for deviceready multiple time on Cordova 2.5?

wfuller

New Member
Could I register 'deviceready' event for each html page? I use the initialize codes of Cordova 2.5 and it work fine. When I copy these codes to a new html file, It always call to the initialize() function of the index.html. \[code\]var app = { // Application Constructor initialize: function() { this.bindEvents(); }, // Bind Event Listeners // // Bind any events that are required on startup. Common events are: // 'load', 'deviceready', 'offline', and 'online'. bindEvents: function() { document.addEventListener('deviceready', this.onDeviceReady, false); }, // deviceready Event Handler // // The scope of 'this' is the event. In order to call the 'receivedEvent' // function, we must explicity call 'app.receivedEvent(...);' onDeviceReady: function() { app.receivedEvent('deviceready'); }, // Update DOM on a Received Event receivedEvent: function(id) { console.log('Received Event: XXX ' + id); }};\[/code\]===============HTML file:....\[code\] <script type="text/javascript"> app.initialize(); </script>\[/code\]....
 
Back
Top