Class: EnvironmentList

EnvironmentList()

Loads the available environments from the CDN, providing an array of Environment instances to interface with. The EnvironmentList uses a singleton instance to interface with the environments, unlike a VersionList.

Constructor

new EnvironmentList()

Source:

Methods

add(environment) → {EnvironmentList}

Add a new Environment to the EnvironmentList.

Parameters:
Name Type Description
environment Environment
Source:
Returns:
Type
EnvironmentList

getEnvironment(environmentValue) → {Environment}

Get an Environment by value, e.g. 'production' or 'staging'.

Parameters:
Name Type Description
environmentValue
Source:
Returns:
Type
Environment

getEnvironmentByOrigin(origin) → {Environment}

Return the Environment for the specified origin, if it exists.

Parameters:
Name Type Description
origin
Source:
Returns:
Type
Environment

getEnvironmentOrFallback(environmentValue, requireModule) → {Environment}

Get the Environment by value, or fallback to the appropriate one by inferring the intended fallback based on the environment value.

Any environments with 'sandbox' in the string will fallback to sandbox. Any environments with 'beta' in the string will fallback to early access. All other environments that no longer exist will fallback to production.

If the 'requireModule' option is set to 'true', the environment will fallback if the target environment exists, but it doesn't include any builds for the specified module.

Parameters:
Name Type Description
environmentValue
requireModule
Source:
Returns:
Type
Environment

getEnvironments() → {Array.<Environment>}

Get the latest array of Environment instances (including any modifications).

Source:
Returns:
Type
Array.<Environment>

getFallback(environmentValue) → {Environment}

Get the fallback environment, this assumes that it is always a beta or dynamic environment that is falling back. Static environments won't have a fallback.

Parameters:
Name Type Description
environmentValue
Source:
Returns:
Type
Environment

getPublicEnvironments() → {Array.<Environment>}

Return only public Environment instances.

Source:
Returns:
Type
Array.<Environment>

getStaticEnvironments() → {Array.<Environment>}

Return only static Environment instances.

Source:
Returns:
Type
Array.<Environment>

includes(environment) → {boolean}

Return true if the environment list contains the specified environment (by string or by Environment

Parameters:
Name Type Description
environment string | Environment
Source:
Returns:
Type
boolean

(async) load() → {Promise.<EnvironmentList>}

Load the remote environments list from the CDN if not already loaded and not forcing a reload.

Source:
Returns:
Type
Promise.<EnvironmentList>

remove(environment) → {EnvironmentList}

Remove an Environment from the EnvironmentList.

Parameters:
Name Type Description
environment Environment
Source:
Returns:
Type
EnvironmentList

toJson()

Convert the EnvironmentList and it's Environment instances to a serializable object.

Source: