简体   繁体   English

检查PhoneGap.exec服务是否存在?

[英]Check PhoneGap.exec service exists?

I am calling my own phonegap service : 我正在拨打自己的phonegap服务

     PhoneGap.exec(
          success, //success
          fail, //fail
          "Cdc", //service
          "Call", //action
          path //args
     );

Since I have this service only on Windows Phone... How do I test if the service exists? 由于我仅在Windows Phone上具有此服务,因此如何测试该服务是否存在?

In newer versions of phonegap you can call your plugins using plugins.cdc.call(); 在新版的phonegap中,您可以使用plugins.cdc.call();来调用插件plugins.cdc.call(); . Now you can easily check if it exists: 现在,您可以轻松检查它是否存在:

if ((typeof plugins !== "undefined") && (typeof plugins.cdc !== "undefined"))
{
    // good to go
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM