@microsoft/teams.common
Version:
<p> <a href="https://www.npmjs.com/package/@microsoft/teams.common" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.common/latest" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.common?activeTa
26 lines (24 loc) • 904 B
TypeScript
/**
* a storage container that can
* get/set/delete items by a unique key
*/
interface IStorage<TKey = any, TValue = any> {
get(key: TKey): TValue | undefined | Promise<TValue | undefined>;
set(key: TKey, value: TValue): void | Promise<void>;
delete(key: TKey): void | Promise<void>;
}
/**
* a list storage container that can
* store/query iterable data
*
* @deprecated Use `IStorage` for persistence and keep ordered collection
* semantics in an application-specific abstraction.
*/
interface IListStorage<TValue = any> extends IStorage<number, TValue> {
push(value: TValue): void | Promise<void>;
pop(): (TValue | undefined) | Promise<TValue | undefined>;
values(): Array<TValue> | Promise<Array<TValue>>;
length(): number | Promise<number>;
where(predicate: (value: TValue, index: number) => boolean): Array<TValue>;
}
export type { IListStorage, IStorage };