Global variable in WebixJet

Hi,
i would like to define a baseURL variable.
I would hold the “base” of my production or development server URL.
I would use this in my models/views so that i dont have to “replace” all the URLs in Ajax cals across all my views/models when i deploy the app to production server.

How/where should i define the baseURL variable to that i could use it in all of my views/models?

you can define a config component and import it in view/model when needed.

config.js
define({
   baseUrl: 'http://site.com/path/to/root/'
})

model.js
define(['config'], function(config){
   webix.ajax(config.baseUrl + 'file.php')...
})

Thanks, thats nice and simple solution.

But unfortunately i have more than 60 modules/views and i need this in almost all of them. Is there not a way where i would just “define” this variable somewhere so that i could just use it in any placace i want without the need to define a new component in every module/view?

then define global variable like window.baseUrl = 'http://site.com/path/to/root/' and use it

Thanks Intregal,
i have defined it with the code bellow before any other JS inclusion (jet, requirejs etc.) in my “index” file. It seems to work.


<<script>>
   var urlBase = "http://localhost/mybackendapp/";>
<</script>>