Skip to content

Watch Game

DANGER

Fiasco games currently do not support hot reloading. We are working on this.

Watch a game for changes and manage hot reloading:

ts
import { mountPausedGame } from "@vaguevoid/tools";

// mount the game
const canvas = document.createElement("canvas");
document.body.appendChild(canvas);

// either:
const game = await mountPausedGame(canvas);
await game.watch();
await game.play();

// or:
const game = await mountPausedGame(canvas, undefined, {
  watchGame: true,
});
await game.play();


// perform some actions when the game has changed
game.on("build:success", () => {
  await game.play();
})

// to stop watch
game.endWatch();