Skip to content
On this page

Module: game/events



GlobalEvents: Object

All types of events able to be sent or emitted from the global event bus.

addLayer(layer: GenericLayer, saveData: Record<string, unknown>) => voidSent whenever a layer is added.
fontsLoadedVoidFunctionUsing document.fonts.ready returns too early on firefox, so we use document.fonts.onloadingdone instead, which doesn't accept multiple listeners. This event fires when that callback is called.
gameWonVoidFunctionSent when the game has ended.
loadSettings(settings: Partial<Settings>) => voidSent when constructing the Settings object. Use it to add default values for custom properties to the object. See features/features.setDefault for setting default values.
onLoadVoidFunctionSent whenever a save has finished loading. Happens when the page is opened and upon switching saves in the saves manager.
removeLayer(layer: GenericLayer) => voidSent whenever a layer is removed.
reset(reset: GenericReset) => void-
setupVue(vue: App<any>) => voidSent when setting up the Vue Application instance. Use it to register global components or otherwise set up things that should affect Vue globally.
update(diff: number, trueDiff: number) => voidSent every game tick. Runs the life cycle of the project.

Defined in





Const globalBus: Emitter<GlobalEvents>

A global event bus for hooking into GlobalEvents.

Defined in