1

有没有办法可以通过 phoneGap.js 检查我的插件是否存在?我希望我的应用程序具有条件逻辑,因此如果它不存在,它就不会使用我的插件的内容。

4

2 回答 2

2
if (typeof window.plugins.myplugin !== 'undefined'){
   // plugin is available
}
于 2012-02-09T13:09:29.617 回答
1

查看 window.PhoneGap.resources 对象:

window.PhoneGap.resources

Object
•  accelerometer: true
•  app: true
•  base: true
•  battery: true
•  camera: true
•  capture: true
•  compass: true
•  contact: true
•  crypto: true
•  device: true
•  file: true
•  filetransfer: true
•  geolocation: true
•  media: true
•  network: true
•  notification: true
•  position: true
•  storage: true
•  __proto__: Object
于 2012-05-18T14:37:22.157 回答