Class: DataStore

DataStore()

Global Data Store. Powered By GUN (http://gun.js.org/)

Constructor

new DataStore()

Source:

Members

connected :boolean

Is the connection active?
Type:
  • boolean
Source:

db

Database object. Don't use this directly unless necessary
Source:

Methods

(async) del(key)

Deletes a key
Parameters:
Name Type Description
key string Key to delete
Source:

ensureReady() → {Promise.<Boolean>}

Returns a Promise that resolves either when the Redis connection or the fallback cache are ready
Source:
Returns:
Type
Promise.<Boolean>

(async) get(key) → {object}

Gets an object by its key
Parameters:
Name Type Description
key string Key to find
Source:
Returns:
Type
object

(async) set(key, val)

Sets the value of a key NOTE: Objects get converted to JSON before saving
Parameters:
Name Type Description
key string Key to set
val object New value
Source:

subscribe(key, handler) → {Gun}

Subscribes to a key and listens for changes
Parameters:
Name Type Description
key string Key
handler function Event handler
Source:
Returns:
- Gun chain
Type
Gun