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 t开发者_JAVA百科o make sure.
Thanks
No 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
精彩评论