最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - .jsm vs .js files - Stack Overflow

programmeradmin1浏览0评论

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 badges
Add a comment  | 

2 Answers 2

Reset to default 26

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

发布评论

评论列表(0)

  1. 暂无评论