42 lines
997 B
TypeScript
42 lines
997 B
TypeScript
/** Ambient declarations for the TaleSpire Symbiote API injected into the page globally */
|
|
|
|
interface DiceResult {
|
|
notation: string;
|
|
results: number[];
|
|
total: number;
|
|
}
|
|
|
|
declare const TS: {
|
|
/** Resolves once the TaleSpire API is ready */
|
|
hasInitialized: Promise<void>;
|
|
|
|
storage: {
|
|
getItem(key: string): Promise<string | null>;
|
|
setItem(key: string, value: string): Promise<void>;
|
|
removeItem(key: string): Promise<void>;
|
|
};
|
|
|
|
dice: {
|
|
/** Place dice in the player's hand for rolling */
|
|
putDiceInHand(diceString: string): Promise<void>;
|
|
onDiceResult: {
|
|
addListener(cb: (result: DiceResult) => void): void;
|
|
};
|
|
};
|
|
|
|
players: {
|
|
onClientJoinEvent: {
|
|
addListener(cb: () => void): void;
|
|
};
|
|
onClientLeaveEvent: {
|
|
addListener(cb: () => void): void;
|
|
};
|
|
};
|
|
|
|
sync: {
|
|
/** Broadcast transient state to all clients on the same board */
|
|
send(data: unknown): void;
|
|
addListener(cb: (data: unknown) => void): void;
|
|
};
|
|
};
|