1 line
5.5 KiB
JavaScript
1 line
5.5 KiB
JavaScript
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('<h1 id="module-game-events" tabindex="-1">Module: game/events <a class="header-anchor" href="#module-game-events" aria-label="Permalink to "Module: game/events""></a></h1><h2 id="interfaces" tabindex="-1">Interfaces <a class="header-anchor" href="#interfaces" aria-label="Permalink to "Interfaces""></a></h2><h3 id="globalevents" tabindex="-1">GlobalEvents <a class="header-anchor" href="#globalevents" aria-label="Permalink to "GlobalEvents""></a></h3><p>• <strong>GlobalEvents</strong>: <code>Object</code></p><p>All types of events able to be sent or emitted from the global event bus.</p><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>addLayer</code></td><td style="text-align:left;">(<code>layer</code>: <a href="./layers#genericlayer"><code>GenericLayer</code></a>, <code>saveData</code>: <a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type" target="_blank" rel="noreferrer"><code>Record</code></a><<code>string</code>, <code>unknown</code>>) => <code>void</code></td><td style="text-align:left;">Sent whenever a layer is added.</td></tr><tr><td style="text-align:left;"><code>fontsLoaded</code></td><td style="text-align:left;"><code>VoidFunction</code></td><td style="text-align:left;">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.</td></tr><tr><td style="text-align:left;"><code>gameWon</code></td><td style="text-align:left;"><code>VoidFunction</code></td><td style="text-align:left;">Sent when the game has ended.</td></tr><tr><td style="text-align:left;"><code>loadSettings</code></td><td style="text-align:left;">(<code>settings</code>: <a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype" target="_blank" rel="noreferrer"><code>Partial</code></a><<a href="./settings#settings"><code>Settings</code></a>>) => <code>void</code></td><td style="text-align:left;">Sent when constructing the Settings object. Use it to add default values for custom properties to the object. <strong><code>See</code></strong> features/features.setDefault for setting default values.</td></tr><tr><td style="text-align:left;"><code>onLoad</code></td><td style="text-align:left;"><code>VoidFunction</code></td><td style="text-align:left;">Sent whenever a save has finished loading. Happens when the page is opened and upon switching saves in the saves manager.</td></tr><tr><td style="text-align:left;"><code>removeLayer</code></td><td style="text-align:left;">(<code>layer</code>: <a href="./layers#genericlayer"><code>GenericLayer</code></a>) => <code>void</code></td><td style="text-align:left;">Sent whenever a layer is removed.</td></tr><tr><td style="text-align:left;"><code>reset</code></td><td style="text-align:left;">(<code>reset</code>: <a href="./../features/reset#genericreset"><code>GenericReset</code></a>) => <code>void</code></td><td style="text-align:left;">-</td></tr><tr><td style="text-align:left;"><code>setupVue</code></td><td style="text-align:left;">(<code>vue</code>: <code>App</code><<code>any</code>>) => <code>void</code></td><td style="text-align:left;">Sent when setting up the Vue Application instance. Use it to register global components or otherwise set up things that should affect Vue globally.</td></tr><tr><td style="text-align:left;"><code>update</code></td><td style="text-align:left;">(<code>diff</code>: <code>number</code>, <code>trueDiff</code>: <code>number</code>) => <code>void</code></td><td style="text-align:left;">Sent every game tick. Runs the life cycle of the project.</td></tr></tbody></table><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/5c11524/src/game/events.ts#L7" target="_blank" rel="noreferrer">profectus/src/game/events.ts:7</a></p><p><a href="https://github.com/profectus-engine/Profectus/blob/5c11524/src/features/reset.ts#L125" target="_blank" rel="noreferrer">profectus/src/features/reset.ts:125</a></p><h2 id="variables" tabindex="-1">Variables <a class="header-anchor" href="#variables" aria-label="Permalink to "Variables""></a></h2><h3 id="globalbus" tabindex="-1">globalBus <a class="header-anchor" href="#globalbus" aria-label="Permalink to "globalBus""></a></h3><p>• <code>Const</code> <strong>globalBus</strong>: <code>Emitter</code><<a href="./events#globalevents"><code>GlobalEvents</code></a>></p><p>A global event bus for hooking into <a href="./events#globalevents">GlobalEvents</a>.</p><h4 id="defined-in-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/5c11524/src/game/events.ts#L55" target="_blank" rel="noreferrer">profectus/src/game/events.ts:55</a></p>',15),n=[l];function s(r,c,i,g,f,h){return a(),t("div",null,n)}const b=e(d,[["render",s]]);export{p as __pageData,b as default};
|