Class: DataStoreClient

Data Store Client

The data store client handles creating/retrieving/destroying stores. Stores are used to save and retrieve data either locally or globally. This data is not persisted. You can add listeners at multiple levels (store or field) and get the updated data as it's updated in the store. Fields are stored within the store as key/value pair.

Methods

createStore
(params, cb){StoreModel}

clients/dataStoreClient.js, line 76

Creates a store.

Name Type Description
params Object

Params object

Name Type Description
store String

The namespace of to use

values ANY optional

Starting values for the store

global Bool optional

Is this a global store?

cb function optional

Will return the store on success.

Returns:
Type Description
StoreModel
  • returns the store
Example
DataStoreClient.createStore({store:"store1",global:false,values:{}},function(storeObject){});

getStore
(params, cb){StoreModel}

clients/dataStoreClient.js, line 40

Get a store. If no store is set then we'll get the global Finsemble store. If global is not set we'll check local first then we'll check global.

Name Type Description
params Object

Params object

Name Type Description
store String optional

The namespace of the value

global Bool optional

Is this a global store?

cb function optional

Will return the value if found.

Returns:
Type Description
StoreModel
  • returns the store
Example
DataStoreClient.getStore({store:'store1'},function(storeObject){});

removeStore
(params, cb)

clients/dataStoreClient.js, line 100

Remove a store . If global is not set and a local store isn't found we'll try to remove the global store

Name Type Description
params Object

Params object

Name Type Description
store String

The namespace of to use

global Bool optional

Is this a global store?

cb function optional
Example
DataStoreClient.removeStore({store:"store1",global:true},function(){});