Phonegap を使用しているかどうかは不明です。そうでない場合は、使用する必要があります (または同等のフレームワーク)。
こちらの指示に従う場合は、ここにリンクの説明を入力してください
生成された index.js を確認すると、デフォルトの phonegap WP7 アプリケーションを構築できます。
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) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
}
};
「dom ready」イベントを取得する前に「device ready」イベントを待つ必要があるため、モバイル デバイスではもう少し複雑です。