I’m trying to break apart my javascript files… similar to PHP includes, I wanted it so that all the different files act as one file… no need to redeclare things anymore.
So, is there anyway to “include” external JS files as if they were hard coded within one JAVASCRIPT Block?
I’ve added the line “**.js:Bundle” in my unoproject file already so that’s done.
Now, I tried requiring the main.js file, but i’m getting an “Observable not defined” error. It seems i need to define Observable again (as well as other variables/objects perhaps?) in each JS file that I require?
So I tried the Javascript File=“xx” method and it still giving me the same error.
I made sure to export the Observable object from the main.ux file already, but I guess that doesnt work (?)
Here’s what I got so far
<JavaScript>
//Ini
var Observable = require("FuseJS/Observable");
var api_url = "http://localhost/api.php?";
var activePage = Observable("depts_page"); //initial page
var statText = Observable("Ready...");
var statTextColor = Observable();
var logo_file = Observable("Assets/logo_light.jpg");
var welcome_text = Observable("Welcome To SMS Queuing System. Please choose a department");
var statColor_Server = Observable("#32CD32");
//initial exports
module.exports = {
Observable: Observable,
statText: statText,
statTextColor: statTextColor,
logo_file: logo_file,
welcome_text: welcome_text,
statColor_Server: statColor_Server,
activePage: activePage
}
</JavaScript>
<JavaScript File="./js/main.js" />
etc....
and my main.js file starts off w/o defining Observable like so…
var cust_name = Observable("");
var mobile_no = Observable("");
var cur_dept_id = Observable("");
var cur_dept_name = Observable("");
var dataSource_depts = Observable();
and that results in the error “Observable is not defined”
What am I missing here?