UNPKG

svelte-phaser

Version:

Create Phaser 3 games with Svelte 3

13 lines (9 loc) 273 B
import { onMount } from 'svelte' import { getGame } from './getGame' export function onGameEvent(event: string, callback: Function) { const game = getGame() onMount(() => { game.events.on(event, callback) return () => game.events.off(event, callback) }) }