Forum

Using multiple JS files

25 January 2018 15:51
Hello! I don't know if this is maybe a stupid question, but is it possible to use multiple JS files to control b4w functions? Because usually you have to type everything b4w-related in the "place your code here" section of the default JS file, otherwise it won't work. I'm imagining having the default file and then multiple other sub-files "linked" into it, that just contain the specific code, without having to register all b4w modules first and so on. I can't really believe that studios like VisCircle can handle their large configurator data by just typing in everything into the default file, so I thought I might ask here if and how this would be possible.
Sorry, I'm quite new to Javascript at all …
29 January 2018 11:16
Hello! I don't know if this is maybe a stupid question, but is it possible to use multiple JS files to control b4w functions? Because usually you have to type everything b4w-related in the "place your code here" section of the default JS file, otherwise it won't work. I'm imagining having the default file and then multiple other sub-files "linked" into it, that just contain the specific code, without having to register all b4w modules first and so on. I can't really believe that studios like VisCircle can handle their large configurator data by just typing in everything into the default file, so I thought I might ask here if and how this would be possible.
Sorry, I'm quite new to Javascript at all …
Working with blend4web JS API of course has no difference from other JS libraries.
So you can use multiple JS files as usual and, what is more, since the 17.12 release you can use
ES6 modules in your app which makes creating and managing complex apps with lots of js files/modules even simpler.

"Place your code here" just marks the place in your app logic where b4w app finishes initialization and scene loading so you can safely interact with the scene via API
Blend4Web Team - developer
Twitter
LinkedIn
 
Please register or log in to leave a reply.