1

下面的代码来自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');
},

谢谢,

4

1 回答 1

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

于 2013-08-20T04:56:05.570 回答