How to load a new js file

Hello,

If it is complicated to open javascript data files (considering the increasingly high protections that destroy gradually all conventional techniques), by cons there is nothing more natural and simple as call a js function.

To avoid any complications and future developments imposing a particular format and remained free to use data files as I want, my idea is to create a multitude of functions containing variable to different data.

The concept works, I tested. My concern is that I want to create a sound bank in the addon lecjoa firefox, and the js files are called to open the page. If I introduce an entire audio library that is currently reflected by loading the entire audio library, although a dozen audio files is used.

To correct, I thought for loading js files according éventement that took place in the HTML page.
Does anyone have any ideas on the best way to do that?

In other words, I have an html page that calls js files that track the events.
According to such an event in the HTML page, a new js file is loaded

cordially

Depends on what kind of add-on API you’re using. You can use XHR, JS Modules, or other techniques depending on what you need.

Hello
thank you for the answer.
It is js module.
I found a solution with include and child.
But I switched to another part of the addon.
I already have the part that creates the sound with the drawings, I now add the part that creates sounds just by imagining the different dimensions.
an audio format I called DNA in 2010
I return soon to say, how I do, to call a js file, based on a condition in another js file
cordially

P.S. DNA it really is very light, some bytes are sufficient for basic sounds

Hello,
After numerous tests, I decided to change technique.
For audio generator plugin lecjoa; rather than seek different forms of generators. I create a general generator can produce all sounds feasible.
First, I create in lecjoa application, a page that reveals the physics of audio. After I will create the plugin.
So that I no longer need to call the js files in functions js

There is still much work to improve the code, any help would be welcome.
On arrival, there is an audio generator of music and human voices, extremely light in firefox, plugin dna

cordially