Phonegap / cordova module not found
I installed the plugin and in its plugin.xml
<js-module src="www/org.bcsphere/bc.js" name="bcjs">
<merges target="BC" />
</js-module>
Should I add a js file to my index.html app?
<script type="text/javascript" src="org.bcsphere/bc.js"></script>
In file myapp / plugins / org.bcsphere.bluetooth / www / org.bcsphere / org.bcsphere / bc.js
var root = this;
/**
* BC namespace includes all kinds of magic things, all the classes is registered on it, enjoy it :).
* @property {string} VERSION - The version of BC
* @namespace
*/
var BC;
if (typeof exports !== 'undefined') {
BC = exports;
} else {
BC = root.BC = {};
}
...
module.exports = BC;
After assembly, I can see in c: \ myapp \ platform \ android \ assets \ www \ plugins \ org.bcsphere.bluetooth \ www \ org.bcsphere \ bc.js all bc. js file enclosed in
cordova.define("org.bcsphere.bluetooth.bcjs", function(require, exports, module) {
...
}
Now I thought what I can do in my app /js/index.js
onDeviceReady: function() {
try{
var BC = window.BC = cordova.require("org.bcsphere.bluetooth.bcjs");
}
catch(err) {
console.log(err);
}
app.receivedEvent('deviceready');
}
But I am getting:
[phonegap] [console.log] module org.bcsphere.bluetooth.bcjs not found
Why can't I find the module?
+3
source to share
No one has answered this question yet
Check out similar questions: