Javascript phonegap index.js文件为什么app.receivedEvent不是this.receivedEvent

Javascript phonegap index.js文件为什么app.receivedEvent不是this.receivedEvent,javascript,phonegap,Javascript,Phonegap,有谁能告诉我为什么在下面的代码中使用了app.receivedEvent('devicerady'),而不是这个.receivedEvent('devicerady') 注释实际上解释了在上使用app的原因: // The scope of 'this' is the event. In order to call the 'receivedEvent' // function, we must explicitly call 'app.receivedEvent(...);' 基本上,事件

有谁能告诉我为什么在下面的代码中使用了app.receivedEvent('devicerady'),而不是
这个.receivedEvent('devicerady')


注释实际上解释了在
上使用
app
的原因:

// The scope of 'this' is the event. In order to call the 'receivedEvent' 
// function, we must explicitly call 'app.receivedEvent(...);'
基本上,事件处理程序将使用自己的
this
上下文调用事件回调(其中
this
将是事件对象)

方法
receivedEvent
在app中定义,而不是
this
(设置为事件回调函数中的事件对象)。要调用
receivedEventil
,在本例中,您可以将其作为包含对象
app
的方法调用:

app.receivedEvent(...);

定义明确的。。。谢谢@Pineda
app.receivedEvent(...);