简体   繁体   中英

Cordova CLI 6.3.0 window.plugins undefined

I am compiling through build.phonegap.com I am using CLI 6.3.0

In my index.html I have

<script type="text/javascript" src="cordova.js"></script>

in my code I have this

document.addEventListener("deviceready", onDeviceReady, false);


onDeviceReady = function() {
    alert(window.plugins);
    alert("try 2");
    alert(cordova.plugins);    }

both are undefined.

thanks

You have to write the for specific plugin. ie for push plugin your have to write :-

var pushNotification;
document.addEventListener("deviceready", function(){
    pushNotification = window.plugins.pushNotification;
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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