Mozilla.com

Summary

Allows a script to import properties, functions, and objects from a signed script that has exported the information.

This feature is not in ECMA 262, Edition 3.

Statement
Implemented in: JavaScript 1.2, NES 3.0

Syntax

import objectName.name1, objectName.name2, ..., objectName.nameN;

import objectName.*;

Parameters

objectName 
Name of the object that will receive the imported names.
nameN 
Property, function, or object to be imported.

Description

The objectName parameter is the name of the object that will receive the imported names. For example, if f and p have been exported, and if obj is an object from the importing script, the following code makes f and p accessible in the importing script as properties of obj.

import obj.f, obj.p;

The first syntax imports the specified properties, functions, and objects from the exported script.

The second syntax imports all properties, functions, and objects from the exported script.

Typically, information in a signed script is available only to scripts signed by the same principals. By exporting (using the export statement) properties, functions, or objects, a signed script makes this information available to any script (signed or unsigned). The receiving script uses the import statement to access the information.

The script must load the export script into a window, frame, or layer before it can import and use any exported properties, functions, and objects.

See also

export


Page last modified 15:01, 31 Dec 2007 by Mgjbot

Tags:

Files (0)