systemjs/docs/api.md
2018-08-25 13:55:35 +02:00

1.5 KiB

SystemJS API

Core API (s.js & system.js)

System.constructor

Type: Function

This represents the System base class, which can be extended or reinstantiated to create a custom System instance.

Example:

  var clonedSystem = new System.constructor();
  clonedSystem.import('x'); // imports in a custom context

System.import(id [, parentURL]) -> Promise(Module)

Type: Function

Loads a module by name taking an optional normalized parent URL argument.

Promise resolves to the ES module namespace value.

Note: If provided, parentURL must be a valid URL, or URL resolution may break.

System.register(deps, declare)

Type: Function

Declaration function for defining modules of the System.register polyfill module format.

Read more on the format at the loader polyfill page

Note: Named System.register is not supported, only anonymous definitions.

System.resolve(id [, parentURL]) -> Promise(string)

Type: Function

Resolves a module specifier relative to an optional parent URL, returning the resolved URL.

Registry API (system.js only)

System.delete(url) -> Boolean

Type: Function

Deletes a module from the registry by URL.

Returns true if the module was found in the registry before deletion.

System.delete('http://site.com/normalized/module/name.js');

System.get(url) -> Module

Type: Function

Retrieve a loaded module from the registry by URL.

System.get('http://site.com/normalized/module/name.js').exportedFunction();