var foo = require('./foo.js'); // module.exports = function (n) { return n * 222 }var _ = require('./underscore-min.js'); // download from underscore.orgCF.userMain = function() {// Watch for network status, get initial statusCF.watch(CF.NetworkStatusChangeEvent, onNetworkStatusChange, true);console.log(foo(2)); // console will output result: 444};// Callback function for network status changefunction onNetworkStatusChange(networkStatus) {if (networkStatus.hasNetwork) {var networkLog = "";_.each(networkStatus, function(value, key, networkStatus) {if (value.length !== 0) {networkLog += "> " + key + " : " + value + "\r";}console.log(networkLog);});CF.setJoin("s1", networkLog);} else {CF.log("Device is disconnected from the network");}}
I browserified main.js into bundle.js using the command below:I added bundle.js into my .gui using the Script Manager and upload to my iPad.
browserify main.js > bundle.js
Zain
--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
The use of 'require' helps to manage module dependencies as I dislike using the Script Manager to attach the .js files and browserify allows me to do all through my favourite editor Sublime Text. When you have lot of modules, the Script Manager is not friendly.I am looking into improving my workflow and do more work via .js and the editor rather than guiDesigner. Another thing I am looking at is creating a .json file for all external systems and use grunt.js to output it into a .gui.Zain