سؤال

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