Module: importModule

Methods

(static) importModule(url, attsopt, opts) → {Promise.<any>}

Parameters:
Name Type Attributes Default Description
url string | Array.<string>
atts PlainObject <optional>
{}
opts PlainObject
Properties
Name Type Attributes Default Description
returnDefault boolean <optional>
false} = {}
Source:
Returns:

Resolves to value of loading module or rejects with Error upon a script loading error.

Type
Promise.<any>

(static) importScript(url, attsopt) → {Promise.<(void|Error)>}

Parameters:
Name Type Attributes Default Description
url string | Array.<string>
atts PlainObject <optional>
{}
Author:
  • Brett Zamir (other items are from `dynamic-import-polyfill`)
Source:
Returns:

Resolves to undefined or rejects with an Error upon a script loading error

Type
Promise.<(void|Error)>

(static) importSetGlobal(url, config) → {Promise.<ArbitraryModule>}

Parameters:
Name Type Description
url string | Array.<string>
config module:importModule.ImportConfig
Source:
Returns:

The promise resolves to either an ArbitraryModule or any other value depends on the export of the targeted module.

Type
Promise.<ArbitraryModule>

(static) importSetGlobalDefault(url, config) → {Promise.<any>}

Parameters:
Name Type Description
url string | GenericArray.<any>
config module:importModule.ImportConfig
Source:
Returns:

The value to which it resolves depends on the export of the targeted module.

Type
Promise.<any>

(inner) addScriptAtts(script, atts) → {void}

Add any of the whitelisted attributes to the script tag.

Parameters:
Name Type Description
script HTMLScriptElement
atts PlainObject.<string, string>
Source:
Returns:
Type
void

(inner) toAbsoluteURL(url) → {string}

Converts a possible relative URL into an absolute one.

Parameters:
Name Type Description
url string
Source:
Returns:
Type
string

Type Definitions

ImportConfig

Type:
Properties:
Name Type Attributes Default Description
global string

The variable name to set on window (when not using the modular version)

returnDefault boolean <optional>
false
Source: