@obelisk/client
Version:
Typescript client to interact with Obelisk on a higher level than the regular ReST API calls.
36 lines (35 loc) • 1.16 kB
TypeScript
import { ClientOptions } from "../interfaces";
/**
* @hidden
*/
export declare class Storage {
static create(options: ClientOptions): Store;
}
/**
* @hidden
*/
export interface Store {
/**
* Retrieve value for key from localStorage, will be JSON.parsed.
* @param key The key of the key-value pair
* @param clearAfterRead Flag to remove the entry after retrieving it _(defaults to false)_
*/
get(key: string, clearAfterRead?: boolean): any;
/**
* Insert the key-value pair to localStorage. Also add expires field.
* @param key The key of the key-value pair
* @param value The value of the key value pair (will be serialized to string).
*/
add(key: string, value: any): void;
/**
* Insert the key-value pair to localStorage. Does not add expires field!
* @param key The key of the key-value pair
* @param value The value of the key value pair (will be serialized to string).
*/
addRaw(key: string, value: any): void;
/**
* Clear all entries that are saved.
* Usefull to be called to logout.
*/
clearAll(): void;
}