Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.jsm vs .js files

Tags:

javascript

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

like image 290
jamesatha Avatar asked Apr 07 '10 09:04

jamesatha


People also ask

What is a .JSM file?

The JSM file type is primarily associated with Gray Design Associates Jigsaws Galore Jigsaw File.

What is jsm in JavaScript?

jsm is used to denote that it is a javascript module, like in MrHIDEn's answer. This pertains more to node than to the browser, but . jsm usually means expect import and export keywords.

What is jsm module?

The NAT-JSM is a flexible testing and diagnostic JTAG Switch Module to accelerate the design, prototyping and operation of your MicroTCA (MTCA) embedded computing system. It provides JTAG vector testing of all slots in a system using just one module.


2 Answers

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.

like image 74
Victor Avatar answered Sep 17 '22 12:09

Victor


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

like image 29
MrHIDEn Avatar answered Sep 19 '22 12:09

MrHIDEn