Class: DistributedStoreClient
Distributed Store Client (Finsemble Flow)
The Distributed Store Client handles creating, retrieving, and 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. For more information, see the Distributed Store tutorial.Methods
-
createGlobalStore(params, cb)
-
Name Type Description params
Name Type Description persist
optional store
string values
any optional cb
StandardErrorCallback optional -
createLocalStore(params, cb)
-
Name Type Description params
Name Type Description persist
optional store
string values
any optional cb
StandardErrorCallback optional -
createStore(params, cb)
-
Creates a store.
Name Type Description params
Name Type Description global
optional Whether a store is accessible outside of the component it's created in.
persist
optional Whether to persist the values of the store to storage. The store must be global to use this flag.
store
string The name of the store.
values
any optional Starting values for the store.
cb
StandardErrorCallback optional Will return the store on success.
Example
FSBL.Clients.DistributedStoreClient.createStore({ store:"store1", global:false, persist: false, values:{} }, function(error, storeObject){});
-
getGlobalStore(params, cb)
-
Name Type Description params
Name Type Description store
string waitForPersistentStoreToLoad
optional cb
StandardErrorCallback optional -
getStore(params, cb)
-
Retrieve a store if it exists in the local scope, otherwise from the global scope.
Name Type Description params
Name Type Description global
optional Get the store only from the global scope.
store
string The name of the store.
waitForPersistentStoreToLoad
optional Set this to true if you know you are getting a reference to a persistent [global] store
cb
StandardErrorCallback optional Will return the value if found.
Example
FSBL.Clients.DistributedStoreClient.getStore({ store:'store1' }, function(error, storeObject){});
-
removeGlobalStore(params, cb)
-
Name Type Description params
Name Type Description store
string cb
StandardErrorCallback optional -
removeStore(params, cb)
-
Remove a store. If global is not set and a local store isn't found, Finsemble will remove the global store.
Name Type Description params
Name Type Description global
optional Whether the store you're trying to remove is a global store.
store
string The name of the store.
cb
StandardErrorCallback optional Callback to be invoked when the store is removed.
Example
FSBL.Clients.DistributedStoreClient.removeStore({ store:"store1", global:true }, function(){});