profectus-docs/assets/api_interfaces_game_events.GlobalEvents.md.4fb77cf2.js

2 lines
14 KiB
JavaScript
Raw Normal View History

import{_ as e,c as t,o as a,N as r}from"./chunks/framework.0799945b.js";const g=JSON.parse('{"title":"Interface: GlobalEvents","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/interfaces/game/events.GlobalEvents.md","lastUpdated":null}'),o={name:"api/interfaces/game/events.GlobalEvents.md"},d=r('<h1 id="interface-globalevents" tabindex="-1">Interface: GlobalEvents <a class="header-anchor" href="#interface-globalevents" aria-label="Permalink to &quot;Interface: GlobalEvents&quot;"></a></h1><p><a href="./../../modules/game/events">game/events</a>.GlobalEvents</p><p>All types of events able to be sent or emitted from the global event bus.</p><h2 id="properties" tabindex="-1">Properties <a class="header-anchor" href="#properties" aria-label="Permalink to &quot;Properties&quot;"></a></h2><h3 id="addlayer" tabindex="-1">addLayer <a class="header-anchor" href="#addlayer" aria-label="Permalink to &quot;addLayer&quot;"></a></h3><p> <strong>addLayer</strong>: (<code>layer</code>: <a href="./../../modules/game/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>&lt;<code>string</code>, <code>unknown</code>&gt;) =&gt; <code>void</code></p><h4 id="type-declaration" tabindex="-1">Type declaration <a class="header-anchor" href="#type-declaration" aria-label="Permalink to &quot;Type declaration&quot;"></a></h4><p> (<code>layer</code>, <code>saveData</code>): <code>void</code></p><p>Sent whenever a layer is added.</p><h5 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to &quot;Parameters&quot;"></a></h5><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>layer</code></td><td style="text-align:left;"><a href="./../../modules/game/layers#genericlayer"><code>GenericLayer</code></a></td><td style="text-align:left;">The layer being added.</td></tr><tr><td style="text-align:left;"><code>saveData</code></td><td style="text-align:left;"><a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type" target="_blank" rel="noreferrer"><code>Record</code></a>&lt;<code>string</code>, <code>unknown</code>&gt;</td><td style="text-align:left;">The layer&#39;s save data object within player.</td></tr></tbody></table><h5 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-label="Permalink to &quot;Returns&quot;"></a></h5><p><code>void</code></p><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/70cda5f/src/game/events.ts#L13" target="_blank" rel="noreferrer">profectus/src/game/events.ts:13</a></p><hr><h3 id="fontsloaded" tabindex="-1">fontsLoaded <a class="header-anchor" href="#fontsloaded" aria-label="Permalink to &quot;fontsLoaded&quot;"></a></h3><p> <strong>fontsLoaded</strong>: <code>VoidFunction</code></p><p>Using document.fonts.ready returns too early on firefox, so we use document.fonts.onloadingdone instead, which doesn&#39;t accept multiple listeners. This event fires when that callback is called.</p><h4 id="defined-in-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/70cda5f/src/game/events.ts#L51" target="_blank" rel="noreferrer">profectus/src/game/events.ts:51</a></p><hr><h3 id="gamewon" tabindex="-1">gameWon <a class="header-anchor" href="#gamewon" aria-label="Permalink to &quot;gameWon&quot;"></a></h3><p> <strong>gameWon</strong>: <code>VoidFunction</code></p><p>Sent when the game has ended.</p><h4 id="defined-in-2" tabindex="-1">Defined in <a cla