EvolvContext

EvolvContext

new EvolvContext()

The EvolvContext provides functionality to manage data relating to the client state, or context in which the variants will be applied.

This data is used for determining which variables are active, and for general analytics.

Source:

Methods

contains(key) → {boolean}

Checks if the specified key is currently defined in the context.

Parameters:
Name Type Description
key

The key to check.

Source:

get(key) → {*}

Retrieve a value from the context.

Parameters:
Name Type Description
key String

The key associated with the value to retrieve.

Source:

pushToArray(key, value, localopt, limitopt) → {boolean}

Adds value to specified array in context. If array doesn't exist its created and added to.

Parameters:
Name Type Attributes Default Description
key String

The array to add to.

value *

Value to add to the array.

local Boolean <optional>
false

If true, the value will only be added to the localContext.

limit Number <optional>

Max length of array to maintain.

Source:

remove(key)

Remove a specified key from the context.

Note: This will cause the effective genome to be recomputed.

Parameters:
Name Type Description
key String

The key to remove from the context.

Source:

resolve() → {Object}

Computes the effective context from the local and remote contexts.

Source:

set(key, value, localopt)

Sets a value in the current context.

Note: This will cause the effective genome to be recomputed.

Parameters:
Name Type Attributes Default Description
key String

The key to associate the value to.

value *

The value to associate with the key.

local Boolean <optional>
false

If true, the value will only be added to the localContext.

Source:

update(update, localopt)

Merge the specified object into the current context.

Note: This will cause the effective genome to be recomputed.

Parameters:
Name Type Attributes Default Description
update Object

The values to update the context with.

local Boolean <optional>
false

If true, the values will only be added to the localContext.

Source: