Mascara: Next Generation JavaScript compiler

Try it Download Buy About Documentation Blog Contact

Package

Compatibility note
The support for packages in Mascara is experimental - it works and is usable, but some decisions have not yet been settled so the semantic of how packages and import works may change in the future. Also, documentation is incomplete at the moment.

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.

X Try!
Mascara JavaScript Generated JavaScript

Translating...
Show compiler settings