/*!
* Copyright 2017 - 2020 by ChartIQ, Inc.
* All rights reserved.
*/
/**
* 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.
* @module DistributedStoreClient
*/
/**
This is how we want our API to work going foward, the way the world does it: `import { processAndSet } from "configClient"`
```
export const processAndSet = () => { ... }
```
This module's single exported object gives us backward compatibility when our core code does this: `import { ConfigClient } from "configClient"`
and provides the object that is attached to FSBL.Clients. This export should be kept as clean and simple as possible.
```
export const ConfigClient = {
processAndSet
}
```
The default export gives us backward compatibility where our core code does this: import ConfigClient from "configClient"
This can be eliminated when our core core is converted to normal imports as in the first example.
```
export default ConfigClient;
```
*/
///
import { StandardErrorCallback, StandardPromise } from "../types";
import StoreModel from "./StoreModel";
/**
* Remove a store. If global is not set and a local store isn't found, Finsemble will remove the global store.
*
* ```javascript
* FSBL.Clients.DistributedStoreClient.removeStore({
* store:"store1",
* global:true
* },
* function(){});
* ```
* @param params.store The name of the store.
* @param params.global Whether the store you're trying to remove is a global store.
* @param cb Callback to be invoked when the store is removed.
*/
export declare const removeStore: (params: {
store: string;
global?: boolean;
}, cb?: StandardErrorCallback) => StandardPromise;
/**
* Retrieve a store if it exists in the local scope, otherwise from the global scope.
*
* ```javascript
* FSBL.Clients.DistributedStoreClient.getStore({
* store:'store1'
* },
* function(error, storeObject){});
* ```
* @param params
* @param params.store The name of the store.
* @param params.global Get the store only from the global scope.
* @param params.waitForPersistentStoreToLoad Set this to true if you know you are getting a reference to a persistent [global] store
* @param cb - Will return the value if found.
* @returns Returns the store
*/
export declare const getStore: (params: {
store: string;
global?: boolean;
waitForPersistentStoreToLoad?: boolean;
}, cb?: StandardErrorCallback) => StandardPromise;
/**
* @private Use createStore();
* @ignore
*/
export declare const createGlobalStore: (params: {
store: string;
persist?: boolean;
values?: any;
}, cb?: StandardErrorCallback) => StandardPromise;
/**
*Creates a store.
* ```javascript
* FSBL.Clients.DistributedStoreClient.createStore({
* store:"store1",
* global:false,
* persist: false,
* values:{}
* },
* function(error, storeObject){});
* ```
* @param params.store The name of the store.
* @param params.values Starting values for the store.
* @param params.global Whether a store is accessible outside of the component it's created in.
* @param params.persist Whether to persist the values of the store to storage. The store must be global to use this flag.
* @param cb Will return the store on success.
* @returns Callback will receive the store
*/
export declare const createStore: (params: {
store: string;
global?: boolean;
persist?: boolean;
values?: any;
}, cb?: StandardErrorCallback) => StandardPromise;
/**
* @ignore
*/
export declare const DistributedStoreClient: {
/**
* For backward compatibility
* @private
* @deprecated
*/
initialize: () => void;
/**
* For backward compatibility
* @private
* @deprecated
*/
onReady: (cb?: any) => void;
createStore: (params: {
store: string;
global?: boolean;
persist?: boolean;
values?: any;
}, cb?: StandardErrorCallback) => StandardPromise;
getStore: (params: {
store: string;
global?: boolean;
waitForPersistentStoreToLoad?: boolean;
}, cb?: StandardErrorCallback) => StandardPromise;
createGlobalStore: (params: {
store: string;
persist?: boolean;
values?: any;
}, cb?: StandardErrorCallback) => StandardPromise;
removeStore: (params: {
store: string;
global?: boolean;
}, cb?: StandardErrorCallback) => StandardPromise;
};
/**
* @ignore
*/
export default DistributedStoreClient;
//# sourceMappingURL=distributedStoreClient.d.ts.map