문제

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

도움이 되었습니까?

해결책 2

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

다른 팁

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top