javascript - alternative to cordova.addConstructor? -


i using phonegap plug in register this

// register plugin  cordova.addconstructor(function () {   window.pushnotification =  new pushnotification(); }); 

i need use cordova @ version 2.5.0, understanding cordova.addconstructor( has been removed in version.

wich api more appropriate instead taking in consideration must compatible cordova version 2.1.0?

you don't need use addconstructor anymore, do:

        if (!window.plugins) {             window.plugins = {};         }         window.plugins.pushnotification = new pushnotification(); 

or guess since don't seem using plugins object, window.pushnotification = new pushnotification()

i tested mock application on 2.0 , 2.5 , both worked.

although asked 2.5, want point out when go update plugin use 2.6, recommended wrap plugin in module.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -