I am creating a javascript module for a firefox extension. I'm curious if the extension makes a difference. In the examples I've seen, it looks like either one is ok and I wanted to make sure.
Thanks
I am creating a javascript module for a firefox extension. I'm curious if the extension makes a difference. In the examples I've seen, it looks like either one is ok and I wanted to make sure.
Thanks
Share Improve this question edited Mar 21, 2016 at 21:39 jamesatha asked Apr 7, 2010 at 9:45 jamesathajamesatha 7,60014 gold badges38 silver badges56 bronze badges2 Answers
Reset to default 26No difference at all.
I guess it is just convenient to know which files are "modules" at a glance, but anyway there is no such thing as a formal javascript module, it is all convention.
Attention: My answer looks obsolete nowadays.
Mozilla defines .jsm here: JavaScript code modules
In their definition you must define exported vars and functions,
var EXPORTED_SYMBOLS = ["foo", "bar"];
Only those will be in the scope.
But I really do not know if this works in HTML pages.
Edited
(Mirror of) JavaScript code modules - color
(Mozilla cach of) JavaScript code modules - old style
As @blaedj mentioned below this would be better answer: JavaScript modules