@okcontract/sdk
Version:
One-stop-shop permissionless SDK for building any blockchain frontend
25 lines (24 loc) • 902 B
TypeScript
import type { AnyCell, MapCell, SheetProxy, ValueCell } from "@okcontract/cells";
export declare class SyncCell<T> {
readonly cell: ValueCell<T>;
readonly first: MapCell<boolean, true>;
private readonly _channel;
private readonly _instanceId;
private readonly _idSet;
private readonly _key;
constructor(proxy: SheetProxy, id: string, key: string, initialValue: T, name?: string);
/**
* Updates the internal cell value and broadcasts the change to other instances.
*/
set(v: T | Promise<T> | AnyCell<T> | Promise<AnyCell<T>>): void | Promise<void>;
setFirst(v: T | Promise<T> | AnyCell<T> | Promise<AnyCell<T>>): Promise<void>;
/**
* Subscribe to another cell.
* - We don't propagate errors.
*/
subscribeTo(cell: AnyCell<T>): Promise<void>;
/**
* Retrieves the current value of the cell.
*/
get(): Promise<T>;
}