javascript - Add Node.js module to Cordova App -
i add discord.io cordova (windows 10 mobile) app.
i've executed npm install discord.io in cordova project direcotry. creates node_modules directory , adds discord.io npm-dependencies:
if try initialize discord.io lib example github:
var discordclient = require('discord.io'); var bot = new discordclient({ autorun: true, email: "my@email.com", password: "secret_passw0rd" }); bot.on('ready', function() { console.log(bot.username + " - (" + bot.id + ")"); }); bot.on('message', function(user, userid, channelid, message, rawevent) { if (message === "ping") { bot.sendmessage({ to: channelid, message: "pong" }); } }); i error message:
0x800a1391 - javascript runtime error: 'require' undefined i tried use cordova.require('discord.io');, results in error:
0x800a139e - javascript runtime error: module discord.io not found how going correctly include , initialize lib?

Comments
Post a Comment