Class: ModuleReference

ModuleReference

Extends

  • Value

Members

id

The absolute id of the module within the `require` package
Properties:
Name Type Description
value string
Source:

require

The require of a package.
Properties:
Name Type Description
value function
Source:

Methods

resolve(otherRequire) → {string}

Resolves this module reference so that it can be required from otherRequire.
Parameters:
Name Type Description
otherRequire function Require from another package that has the package of this module as a dependency.
Source:
Throws:
If there is no mapping from this require inside otherRequire.
Type
Error
Returns:
The module id to pass to otherRequire that results in this module.
Type
string
Examples
var ref = new ModuleReference().initWithIdAndRequire("core/uuid", montageRequire);
ref.resolve(applicationRequire); // => "montage/core/uuid"
var ref = new ModuleReference().initWithIdAndRequire("ui/main.reel", applicationRequire);
ref.resolve(montageRequire); // => Error
// because there is no module id such that montageRequire(id) can
// return the module from inside your application