Reputation: 2993
Piecing together the code as much as I can from http://docs.phonegap.com/en/edge/guide_hybrid_plugins_index.md.html#Plugin%20Development%20Guide_sample_javascript and http://docs.phonegap.com/en/edge/guide_platforms_ios_plugin.md.html#iOS%20Plugins I have tried to make a demo that uses the "Echo" plugin.
It doesn't work.
In Safari's Web Inspector, I get the following when running on iPhone simulator:
[Log] Received Event: deviceready (index.js, line 47)
[Error] TypeError: '[object Object]' is not a function (evaluating 'window.echo("echome", function(echoValue) {
alert(echoValue == "echome"); // should alert true.
})')
receivedEvent (index.js, line 49)
onDeviceReady (index.js, line 36)
fire (cordova.js, line 750)
(anonymous function) (cordova.js, line 223)
My best understanding of this plugin implementation is here: https://github.com/thegreatmichael/phonegap-echo-plugin-example and my best understanding of how to use it (i modified the basic, generated app as little as possible), is here: https://github.com/thegreatmichael/phonegap-app-uses-echo
What should I do to have a working example of the echo plugin?
Upvotes: 1
Views: 452
Reputation: 11721
I think your issue is because in plugin.xml you use clobbers
but in your js you don't use module.exports
to export your plugin object.
You have either to use <runs/>
instead of <clobbers target="echo" />
or modify your js to use module.exports (have a look at core cordova plugins for sample).
Upvotes: 1