A network environment configuration utility object.

This extends Util.Configuration to add support for standard properties needed to access the SolarNetwork API, such as host and protocol values.

Hierarchy

Constructors

Properties

Accessors

Methods

Constructors

  • Constructor.

    This will define the following default properties, if not supplied on the config argument:

    host
    `data.solarnetwork.net`
    protocol
    `https`
    port
    `443`

    These properties correspond to those on the window.location object when running in a browser. Thus to construct an environment based on the location of the current page you can create an instance like this:

    const env = new Environment(window.location);
    

    Parameters

    • Optional config: Partial<HostConfigInfo>

      an optional set of properties to start with

    Returns EnvironmentConfig

Properties

#map: Map<string, any>

The configuration data.

Accessors

  • get props(): Map<string, any>
  • Get direct access to the underlying property map.

    Returns Map<string, any>

Methods

  • Set or toggle the enabled status of a given key.

    If the enabled parameter is not passed, then the enabled status will be toggled to its opposite value.

    Parameters

    • key: string

      the key to set

    • Optional enabled: boolean

      the optional enabled value to set

    Returns EnvironmentConfig

    this object to allow method chaining

  • Check if TLS is in use via the https protocol.

    Returns boolean

    true if the protocol is set to https

Generated using TypeDoc