Question

Is there a way to include a javascript file to a XBL instead of copy all the script to it?

Was it helpful?

Solution 2

I found that I need to add it to the Xul file, so I can use it in the XBL.

OTHER TIPS

I believe it is:

<xbl:script src="/xbl/foo/bar/myScript.js"/>

If you only need to run the script once and it doesn't need to access your document (i.e. it just defines methods) then the easiest way is to turn it into a module, see https://developer.mozilla.org/en/Components.utils.import but if you need the script to run once per element then you will need to use the subscript loader (see the link from the above page).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top