LoopMounttype
The mounted Loop game and progress, native controls and cleanup handle.
Import it
import type { LoopMount } from "@johnmorrisdotca/kazu/loop";
Also exported from: @johnmorrisdotca/kazu/loop/play, @johnmorrisdotca/kazu
Definition
type LoopMount = {
game: () => LoopGame;
progress: () => string;
set: (options: LoopDrawOptions) => void;
restart: () => void;
destroy: () => void;
};
Members
| Name | Type | Description |
|---|---|---|
game | () => LoopGame | |
progress | () => string | |
set | (options: LoopDrawOptions) => void | |
restart | () => void | |
destroy | () => void |
Examples
import type { LoopBoard, LoopMount } from "@johnmorrisdotca/kazu/loop";
import { mountLoop } from "@johnmorrisdotca/kazu/loop";
const loopBoard: LoopBoard = {"width":5,"height":5,"clues":[2,3,1,null,null,3,1,1,null,null,3,2,2,null,null,3,0,2,2,null,2,2,1,2,3]};
const host = document.createElement("div");
document.body.append(host);
const player: LoopMount = mountLoop(host,{board:loopBoard});
console.log(player.progress());
player.destroy();