import{_ as e,c as t,o as a,N as o}from"./chunks/framework.0799945b.js";const b=JSON.parse('{"title":"Module: game/events","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/game/events.md","lastUpdated":null}'),d={name:"api/modules/game/events.md"},l=o('

Module: game/events

Interfaces

GlobalEvents

GlobalEvents: Object

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

NameTypeDescription
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

profectus/src/game/events.ts:7

profectus/src/features/reset.ts:116

Variables

globalBus

Const globalBus: Emitter<GlobalEvents>

A global event bus for hooking into GlobalEvents.

Defined in

profectus/src/game/events.ts:55

',15),n=[l];function s(r,c,i,g,f,h){return a(),t("div",null,n)}const p=e(d,[["render",s]]);export{b as __pageData,p as default};