import{_ as e,c as t,o as a,N as o}from"./chunks/framework.0799945b.js";const p=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('
• GlobalEvents: Object
All types of events able to be sent or emitted from the global event bus.
Name | Type | Description |
---|---|---|
addLayer | (layer : GenericLayer , saveData : Record <string , unknown >) => void | Sent whenever a layer is added. |
fontsLoaded | VoidFunction | Using 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. |
gameWon | VoidFunction | Sent when the game has ended. |
loadSettings | (settings : Partial <Settings >) => void | Sent 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. |
onLoad | VoidFunction | Sent whenever a save has finished loading. Happens when the page is opened and upon switching saves in the saves manager. |
removeLayer | (layer : GenericLayer ) => void | Sent whenever a layer is removed. |
reset | (reset : GenericReset ) => void | - |
setupVue | (vue : App <any >) => void | Sent 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 ) => void | Sent every game tick. Runs the life cycle of the project. |
profectus/src/game/events.ts:7
profectus/src/features/reset.ts:125
• Const
globalBus: Emitter
<GlobalEvents
>
A global event bus for hooking into GlobalEvents.