The export statement is used to allow a signed script to provide properties, functions, and objects to other signed or unsigned scripts. It is an ancient Netscape 4 feature that has been removed in Firefox 3.5 (bug 447713). In the future, a new export declaration will be specified by ECMAScript 6 modules.
Syntax
Example 1: export name1, name2, ..., nameN; Example 2: export *;
nameN
- Property, function, or object to be exported.
Description
Typically, information in a signed script is available only to scripts signed by the same principals. By exporting properties, functions, or objects, a signed script makes this information available to any script (signed or unsigned). The receiving script uses the companion import statement to access the information.
Example 1 shows the syntax for exporting specified properties, functions, and objects.
Example 2 shows the syntax for exporting all the properties, functions, and objects from the script.
Specifications
Prior to ECMAScript Edition 6, no import/export or module functionality has been defined in ECMA-262 standards.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | Not supported | Not supported (Netscape 4 until Firefox 3.5) |
Not supported | Not supported | Not supported |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |