Class: Storage

Storage


new Storage(config)

Parameters:
Name Type Description
config object

Settings from game/config.

Source:

Members


id :string

Namespace to save data to.

Type:
  • string
Source:

supported :boolean

Is local storage supported?

Type:
  • boolean
Source:

Methods


get(key [, defaultValue])

Get key from local storage.

Parameters:
Name Type Argument Description
key string

Key of the property

defaultValue * <optional>

Default value if no value is found

Source:
Returns:

value Value for the key

Type
*

has(key)

Check if a key is in local storage.

Parameters:
Name Type Description
key string

Key to find

Source:
Returns:

Whether a property with this key exists

Type
boolean

remove(key)

Remove key from local storage.

Parameters:
Name Type Description
key string

Key to remove

Source:

reset()

Reset local storage. This removes ALL keys.

Source:

set(key, value)

Set value to local storage.

Parameters:
Name Type Description
key string

Key of the property

value *

Value to set

Source:

Class: Storage

Storage


new Storage()

Local storage wrapper.
No need to create instance, an instance is exported as default.

Source:

Members


id :string

Namespace to save data to.

Type:
  • string
Source:

supported :boolean

Is local storage supported?

Type:
  • boolean
Source:

Methods


get(key [, defaultValue])

Get key from local storage.

Parameters:
Name Type Argument Description
key string

Key of the property

defaultValue * <optional>

Default value if no value is found

Source:
Returns:

value Value for the key

Type
*

has(key)

Check if a key is in local storage.

Parameters:
Name Type Description
key string

Key to find

Source:
Returns:

Whether a property with this key exists

Type
boolean

remove(key)

Remove key from local storage.

Parameters:
Name Type Description
key string

Key to remove

Source:

reset()

Reset local storage. This removes ALL keys.

Source:

set(key, value)

Set value to local storage.

Parameters:
Name Type Description
key string

Key of the property

value *

Value to set

Source: