Mascara JavaScript compiler

Try it Download Buy About Documentation Blog Contact

Package

A package defines a namespace for classes, functions or variables.

Syntax definition [Help]
package [ name ] {
   declarations
}

The declarations in a packages are made available by importing the package:

package p {
	var x = 1;
}
 
import p;
var y = x;

If a package is not defined in the same file as the import statement, then the importer looks for a file with the same name as the package and imports that file and the package.

A package without a name is called an anonymous package. Declarations in an anonymous package are invisible from the outside. You can have several anonymous packages; the declarations inside each package are invisible from other packages.