I've been wondering why my old plugins does not work in cordova 2.2.0. As I found out that there is a new structure in how to make javascript file for Plugins. I was able to make it work but I have a question.
Before I can do this.
window.plugins.pluginName.functionName(\"%@\");
Which would allow me to call functionname
in from objective c to javascript.
How would that appply to the new format for 2.2.0 versions?
The window.plugins object is no more. In your plugin's js code what you would need to do is:
if (!window.plugins) {
window.plugins = {};
}
if (!window.plugins.pluginName) {
window.plugins.pluginName = new pluginName();
}
and then it should act the way it used to without having to change the rest of your code.
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.