Reputation: 28375
Is there a way to include a javascript file to a XBL instead of copy all the script to it?
Upvotes: 0
Views: 129
Reputation: 55402
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).
Upvotes: 0
Reputation: 28375
I found that I need to add it to the Xul file, so I can use it in the XBL.
Upvotes: 0
Reputation: 207537
I believe it is:
<xbl:script src="/xbl/foo/bar/myScript.js"/>
Upvotes: 1