I am newbie to javascript.I am developing mobile apps using Titanium studio.
My question is regarding javascript which is as follows.
I have one file js file named commonUi.js in this file I am defining common UI components which I can use in different windows.
Now I am defining two object function inside commonUi.js which are as follows.
function component1(){
}
function component2(){
}
Now My core question is can I write following two statements inside my commonUi.js file
- module.exports = component1;
- module.exports = component2;
Any help greatly appreciated.
You can only have one
module.exports =in your module, but you can do something like this to achieve what you want:And then you can just use it like this:
commonUi.component1();