Reputation: 3223
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?
Upvotes: 1
Views: 458
Reputation: 23273
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.
Upvotes: 1