@haelp/teto
Version:
A typescript-based controllable TETR.IO client.
54 lines • 1.65 kB
TypeScript
export interface IGEHandlerSnapshot {
iid: number;
players: {
[key: number]: string;
};
}
/**
* Manages network IGE cancelling
*/
export declare class IGEHandler {
/** @hidden */
private players;
/** @hidden */
private iid;
/** @hidden */
private extract;
/** @hidden */
private stringify;
/**
* Manages network IGE cancelling
* @param players - list of player ids
*/
constructor(players: number[]);
/**
* Sends a message to a player.
* @param options - info on sending player
* @param options.playerID - The ID of the player to send the message to.
* @param options.amount - The amount of the message.
* @throws {Error} If the player is not found.
*/
send({ playerID, amount }: {
playerID: number;
amount: number;
}): void;
/**
* Receives a garbage from a player and processes it.
* @param garbage - garbage object of data
* @param garbage.playerID - The ID of the player sending the garbage.
* @param garbage.ackiid - The IID of the last acknowledged item.
* @param garbage.iid - The IID of the incoming item.
* @param garbage.amount - The amount of the incoming item.
* @returns The remaining amount after processing the message.
* @throws {Error} If the player is not found.
*/
receive({ playerID, ackiid, iid, amount }: {
playerID: number;
ackiid: number;
iid: number;
amount: number;
}): number;
snapshot(): IGEHandlerSnapshot;
fromSnapshot(snapshot: IGEHandlerSnapshot): void;
}
//# sourceMappingURL=ige.d.ts.map