I wan't to create a .js file which has helper functions. These functions should be called in the
index.js
I get the following error:
[ERROR] : Script Error Couldn't find module: ./helper/WBMHelperFunctions.js for architecture: arm64
Here is the code: (index.js)
const TAB_NUMBER = 5;
const TAB_NAMES = ["Start","Sales Partner","Products","About us","Contact"];
var helperFunctionsModule = require('./helper/WBMHelperFunctions.js');
var tabBarController = helperFunctionsModule.createTabBarControllerWithNumberOfTabs(TAB_NUMBER,TAB_NAMES);
var mainWindow = Titanium.UI.createWindow();
mainWindow.add(tabBarController);
(WBMHelperFunctions.js)
function createTabBarControllerWithNumberOfTabs(tabsNumber,tabNamesArray)
{
var tabBarController = Titanium.UI.createTabGroup();
for(i = 0 ; i < tabsNumber ; i++)
{
//create N windows for N tabs
var win = Titanium.UI.createWindow({
title:tabNamesArray[i]
});
var tab = Titanium.UI.createTab({
title:tabNamesArray[i],
window:win
});
tabBarController.add(tab);
}
return tabBarController;
}
This was asked two months ago, so hopefully you have your answer by now, but for anyone who comes across this page:
Assuming that the file is in the path you specified, then
is incorrect because of the ".js".
It should be: