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:

project-explorer

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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -