import{_ as e,c as t,o as a,a as s}from"./app.ab34650d.js";const g=JSON.parse('{"title":"Module: game/persistence","description":"","frontmatter":{"editLink":false},"headers":[{"level":2,"title":"Type Aliases","slug":"type-aliases"},{"level":3,"title":"Persistent","slug":"persistent"},{"level":3,"title":"State","slug":"state"},{"level":2,"title":"Variables","slug":"variables"},{"level":3,"title":"DefaultValue","slug":"defaultvalue"},{"level":3,"title":"Deleted","slug":"deleted"},{"level":3,"title":"PersistentState","slug":"persistentstate"},{"level":3,"title":"StackTrace","slug":"stacktrace"},{"level":2,"title":"Functions","slug":"functions"},{"level":3,"title":"deletePersistent","slug":"deletepersistent"},{"level":3,"title":"persistent","slug":"persistent-1"}],"relativePath":"api/modules/game/persistence.md","lastUpdated":null}'),r={name:"api/modules/game/persistence.md"},n=s('

Module: game/persistence

Type Aliases

Persistent

\u01AC Persistent<T>: Ref<T> & { [DefaultValue]: T ; [Deleted]: boolean ; [PersistentState]: Ref<T> ; [StackTrace]: string }

A Ref that has been augmented with properties to allow it to be saved and loaded within the player save data object.

Type parameters

NameType
Textends State = State

Defined in

profectus/src/game/persistence.ts:48


State

\u01AC State: string | number | boolean | DecimalSource | { [key: string]: State; } | { [key: number]: State; }

This is a union of things that should be safely stringifiable without needing special processes or knowing what to load them in as.

Defined in

profectus/src/game/persistence.ts:37

Variables

DefaultValue

\u2022 Const DefaultValue: typeof DefaultValue

A symbol used in Persistent objects.

See

[DefaultValue]

Defined in

profectus/src/game/persistence.ts:20


Deleted

\u2022 Const Deleted: typeof Deleted

A symbol used in Persistent objects.

See

[Deleted]

Defined in

profectus/src/game/persistence.ts:30


PersistentState

\u2022 Const PersistentState: typeof PersistentState

A symbol used in Persistent objects.

See

[PersistentState]

Defined in

profectus/src/game/persistence.ts:15


StackTrace

\u2022 Const StackTrace: typeof StackTrace

A symbol used in Persistent objects.

See

[StackTrace]

Defined in

profectus/src/game/persistence.ts:25

Functions

deletePersistent

\u25B8 deletePersistent(persistent): void

Mark a Persistent as deleted, so it won't be saved and loaded. Since persistent refs must be created during a layer's options func, features can not create persistent refs after evaluating their own options funcs. As a result, it must create any persistent refs it might need. This function can then be called after the options func is evaluated to mark the persistent ref to not be saved or loaded.

Parameters

NameType
persistentPersistent<State>

Returns

void


persistent

\u25B8 persistent<T>(defaultValue): Persistent<T>

Create a persistent ref, which can be saved and loaded. All (non-deleted) persistent refs must be included somewhere within the layer object returned by that layer's options func.

Type parameters

NameType
Textends State

Parameters

NameTypeDescription
defaultValueT | Ref<T>The value the persistent ref should start at on fresh saves or when reset.

Returns

Persistent<T>

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