下面的代码来自PhoneGap 3.0生成的index.js,我的问题是为什么它不能像往常一样使用this.receivedEvent(并将事件对象作为参数)。
// 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');
},
谢谢,
答案 0 :(得分:0)
通常的电话:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Now safe to use device APIs
}
请参阅官方网站:http://docs.phonegap.com/en/3.0.0/cordova_events_events.md.html#deviceready