Skip to content

GameShare beta ​

Class of @v12-engine/client

ts
export declare class GameShare

Sharing a game played in the page for others to watch (shareGame), for as long as the game lasts: started and stopped from its panel (sharePanel), which only shows it, so that a cinematic hiding the HUD does not stop it. Once shared, the next game under the same key is shared at once too, until it is stopped: a campaign watched from mission to mission

Members ​

constructor ​

ts
constructor(options: {
        world: World;
        player: PlayerId;
        key: string;
        name: string;
        storage?: KeptStorage;
    });

Constructs a new instance of the GameShare class

dispose ​

ts
dispose(): void;

The game is over: watchers are told, and they wait for the next one

name ​

ts
get name(): string;

What the game is called, for who watches

note ​

ts
readonly note: Accessor<string>;

What it is doing, or what went wrong: "Connecting…", "Another page shares it already". Empty when there is nothing to say

relay ​

ts
get relay(): string;

Where it is shared through: the relay's address

start ​

ts
start(): Promise<void>;

Shares the game, and the ones after it under the same key

stop ​

ts
stop(): void;

Stops sharing, and the games after it are not shared either

watchers ​

ts
readonly watchers: Accessor<number | undefined>;

How many watch it, while it is shared: nothing while it is not