HTMLページごとに「deviceready」イベントを登録できますか?Cordova 2.5の初期化コードを使用しましたが、正常に動作します。これらのコードを新しいhtmlファイルにコピーすると、常にindex.htmlのinitialize()関数が呼び出されます。
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);
}
};
=============== HTMLファイル:
...。
<script type="text/javascript">
app.initialize();
</script>
...。