All References
Reference
This page is generated from TypeDoc JSON at build time and updates when src/generated/docs.json is regenerated.
Items: 151
Kinds indexKinds
- Kind 1 (1)
- Kind 1024 (20)
- Kind 128 (1)
- Kind 131072 (24)
- Kind 16384 (1)
- Kind 2048 (26)
- Kind 2097152 (8)
- Kind 262144 (7)
- Kind 32768 (30)
- Kind 4096 (26)
- Kind 524288 (7)
Jump to an item
Kind 1 (1)
-
@apps/library— id: 0 (link)
Kind 1024 (20)
-
achievements— id: 421 — Achievements data that is not tied to save data. So it can persist across saves and be used to track achievements. (apps/library/src/types/if-engine.ts :98) (link) -
autoSave— id: 388 — If set to `passage`, the story variables are saved on every passage navigation to a special save slot If set to `state`, the story variables are saved on every state change (i.e when a variable is changed) to a special save slot (apps/library/src/types/if-engine.ts :146) (link) -
cache— id: 393 — Optional cache adapter to use to speed up state fetching (apps/library/src/types/if-engine.ts :184) (link) -
classId— id: 399 — Immutable id that must be stable (i.e never ever change if you wish to keep current saves compatible) since it is used to index registered classes in the engine (packages/engine-class/src/types/userland-classes.ts :20) (link) -
compress— id: 390 — Determines whether or not save/achievement/settings data will be compressed. Note that even when this is enabled, compression will not occur unless the stringified data is long enough (> 1KB) (apps/library/src/types/if-engine.ts :161) (link) -
emitMode— id: 395 — Optimization strategy for state change events. This setting controls how the engine handles state snapshots when emitting `:stateChange` events, balancing between performance and data accuracy. **Performance Impact:** - `acc` (acc): Deep clones the old state before modifications, ensuring complete isolation between `oldState` and `newState` objects. Use when you need guaranteed data integrity but may impact performance with large state objects. - `perf` (performance): Avoids deep cloning for better performance. In rare edge cases with complex state caching scenarios, `oldState` and `newState` might reference the same object, but provides significant performance benefits for large states. (apps/library/src/types/if-engine.ts :205) (link) -
initialSeed— id: 391 — Intial seed for predictable rng. **Must be a number between 0 and 2^32 - 1 (inclusive).** (apps/library/src/types/if-engine.ts :169) (link) -
loadOnStart— id: 389 — If `true`, the most recent save (if any) will be loaded when the engine is initialized (apps/library/src/types/if-engine.ts :153) (link) -
maxStates— id: 383 — Maximum number of individual states that will be stored before old ones get merged into each other (apps/library/src/types/if-engine.ts :111) (link) -
name— id: 66 — Must be unique to prevent conflicts (apps/library/src/engine/if-engine.ts :198) (link) -
persistence— id: 394 — Optional persistence adapter for saving support (apps/library/src/types/if-engine.ts :187) (link) -
prototype— id: 403 (packages/engine-class/src/types/userland-classes.ts :27) (link) -
regenSeed— id: 392 — Determines if and when the prng seed will be regenerated. If set to `passage`, the seed will be regenerated on every passage navigation. If set to `eachCall`, the seed will be regenerated on every call to the `random` getter. If set to `false`, the seed will not be regenerated at all. Essentially, the engine will use the initial seed for all random number generation. (apps/library/src/types/if-engine.ts :181) (link) -
saveCompat— id: 387 — Determines how strict the engine will be when deciding if a save is compatible the the current engine's version. If set to `strict`, the engine will only consider saves that only differ by the `patch` version as the current engine's version as compatible. If set to `liberal`, the engine will only consider saves that differ by the `patch` version, and have a lower or equal `minor` version as compatible. (apps/library/src/types/if-engine.ts :138) (link) -
saveData— id: 419 (apps/library/src/types/if-engine.ts :89) (link) -
saveSlots— id: 385 — Maximum amount of saves at any given time. Must not be less than 1 (apps/library/src/types/if-engine.ts :122) (link) -
saveVersion— id: 386 — Semantic version to use for all newly created saves by the engine. Also acts as a reference point for the engine to determine if a previous save is compatible with the current version of the story. (apps/library/src/types/if-engine.ts :127) (link) -
settings— id: 420 — Story specific settings that shouldn't be tied to save data like audio volume, font size, etc (apps/library/src/types/if-engine.ts :92) (link) -
stateMergeCount— id: 384 — Number of individual states that will be merged into one when the state fills up (apps/library/src/types/if-engine.ts :114) (link) -
toJSON— id: 409 — Must return a serializable plain object that when deserialized, can be reinitialized into an identical clone of the class. Is required for persistence. (packages/engine-class/src/types/userland-classes.ts :9) (link)
Kind 128 (1)
-
SugarboxEngine— id: 1 — The main engine for Sugarbox that provides headless interface to basic utilities required for Interactive Fiction Dispatches custom events that can be listened to with "addEventListener" (apps/library/src/engine/if-engine.ts :187) (link)
Kind 131072 (24)
-
TAchievementData— id: 424 (link) -
TAchievementData— id: 5 (link) -
TAchievementData— id: 13 (link) -
TEventType— id: 182 (link) -
TEventType— id: 201 (link) -
TNewSaveStructure— id: 222 (link) -
TOldSaveStructure— id: 221 (link) -
TPassageData— id: 2 (link) -
TPassageName— id: 7 (link) -
TPassageName— id: 15 (link) -
TPassageTag— id: 6 (link) -
TPassageTag— id: 14 (link) -
TPassageType— id: 10 (link) -
TSaveData— id: 422 (link) -
TSerializedStructure— id: 412 (link) -
TSerializedStructure— id: 406 (link) -
TSettingsData— id: 423 (link) -
TSettingsData— id: 4 (link) -
TSettingsData— id: 12 (link) -
TStateVariables— id: 416 (link) -
TSugarBoxVariables— id: 433 (link) -
TSugarBoxVariables— id: 396 (link) -
TVariables— id: 3 (link) -
TVariables— id: 11 (link)
Kind 16384 (1)
-
SugarBoxClassConstructor— id: 404 (link)
Kind 2048 (26)
-
addPassage— id: 109 (apps/library/src/engine/if-engine.ts :512) (link) -
addPassages— id: 116 (apps/library/src/engine/if-engine.ts :517) (link) -
backward— id: 123 (apps/library/src/engine/if-engine.ts :527) (link) -
deleteAllSaveSlots— id: 126 (apps/library/src/engine/if-engine.ts :537) (link) -
deleteSaveSlot— id: 128 (apps/library/src/engine/if-engine.ts :557) (link) -
forward— id: 131 (apps/library/src/engine/if-engine.ts :591) (link) -
fromJSON— id: 400 (packages/engine-class/src/types/userland-classes.ts :23) (link) -
getPassages— id: 143 (apps/library/src/engine/if-engine.ts :634) (link) -
getSaves— id: 134 (apps/library/src/engine/if-engine.ts :602) (link) -
getVisitCount— id: 156 (apps/library/src/engine/if-engine.ts :679) (link) -
init— id: 8 (apps/library/src/engine/if-engine.ts :330) (link) -
loadFromExport— id: 159 (apps/library/src/engine/if-engine.ts :698) (link) -
loadFromSaveSlot— id: 162 (apps/library/src/engine/if-engine.ts :731) (link) -
loadRecentSave— id: 165 (apps/library/src/engine/if-engine.ts :759) (link) -
loadSaveFromData— id: 167 (apps/library/src/engine/if-engine.ts :779) (link) -
navigateTo— id: 177 (apps/library/src/engine/if-engine.ts :902) (link) -
off— id: 199 (apps/library/src/engine/if-engine.ts :948) (link) -
on— id: 180 (apps/library/src/engine/if-engine.ts :932) (link) -
registerClasses— id: 216 (apps/library/src/engine/if-engine.ts :960) (link) -
registerMigrators— id: 219 (apps/library/src/engine/if-engine.ts :972) (link) -
reset— id: 227 (apps/library/src/engine/if-engine.ts :997) (link) -
saveToExport— id: 230 (apps/library/src/engine/if-engine.ts :1008) (link) -
saveToSaveSlot— id: 232 (apps/library/src/engine/if-engine.ts :1051) (link) -
setAchievements— id: 237 (apps/library/src/engine/if-engine.ts :1101) (link) -
setSettings— id: 247 (apps/library/src/engine/if-engine.ts :1131) (link) -
setVars— id: 99 (apps/library/src/engine/if-engine.ts :447) (link)
Kind 2097152 (8)
-
SugarBoxAnyKey— id: 413 (apps/library/src/types/if-engine.ts :44) (link) -
SugarBoxCacheAdapter— id: 415 — Cache Adapter specifically for caching the state of variables (apps/library/src/types/adapters.ts :16) (link) -
SugarBoxClassConstructor— id: 397 — All userland custom class constructors need to implement this if they must be part of the story's state (packages/engine-class/src/types/userland-classes.ts :16) (link) -
SugarBoxClassInstance— id: 407 — All userland custom classes need to implement this if they must be part of the story's state (packages/engine-class/src/types/userland-classes.ts :4) (link) -
SugarBoxConfig— id: 381 (apps/library/src/types/if-engine.ts :106) (link) -
SugarBoxExportData— id: 417 — Export data structure used for saving the state of the engine to disk. Contains save data, settings, and achievements (apps/library/src/types/if-engine.ts :84) (link) -
SugarBoxPersistenceAdapter— id: 414 — Persistence Adapter specifically for saving the state of variables (apps/library/src/types/adapters.ts :32) (link) -
SugarBoxSaveData— id: 425 — Data structure used for saving the state of the engine Contains initial state, snapshots, current story index and other relevant metadata (apps/library/src/types/if-engine.ts :53) (link)
Kind 262144 (7)
-
achievements— id: 235 (apps/library/src/engine/if-engine.ts :1089) (link) -
index— id: 257 (apps/library/src/engine/if-engine.ts :1158) (link) -
passage— id: 259 (apps/library/src/engine/if-engine.ts :1166) (link) -
passageId— id: 265 (apps/library/src/engine/if-engine.ts :1171) (link) -
random— id: 267 (apps/library/src/engine/if-engine.ts :1176) (link) -
settings— id: 269 (apps/library/src/engine/if-engine.ts :1193) (link) -
vars— id: 271 (apps/library/src/engine/if-engine.ts :1200) (link)
Kind 32768 (30)
-
args— id: 405 (link) -
args— id: 16 (link) -
customClasses— id: 218 (link) -
data— id: 161 (link) -
emitEvent— id: 108 — If true, a ":stateChange" event will be emitted. Set this to false if you use it within a `:stateChange` listener (link) -
emitEvent— id: 256 — If true, a ":settingChange" event will be emitted. Set this to false if you use this within an `:settingChange` listener (link) -
emitEvent— id: 246 — If true, an ":achievementChange" event will be emitted. Set this to false if you use this within an `:achievementChange` listener (link) -
listener— id: 188 (link) -
listener— id: 207 (link) -
migrators— id: 223 (link) -
options— id: 196 (link) -
options— id: 215 (link) -
passageData— id: 118 (link) -
passageData— id: 111 (link) -
passageId— id: 179 (link) -
passageId— id: 158 — TODO: benchmark this later to see if caching will be beneficial (link) -
producer— id: 101 (link) -
producer— id: 249 (link) -
producer— id: 239 (link) -
query— id: 145 (link) -
resetSeed— id: 229 — if true, the initial seed is randomised (link) -
save— id: 169 — The save data to load (link) -
saveSlot— id: 234 — if not provided, defaults to the autosave slot (link) -
saveSlot— id: 164 — if not provided, defaults to the autosave slot (link) -
saveSlot— id: 130 — if not provided, defaults to the autosave slot (link) -
serializedData— id: 402 (link) -
step— id: 133 (link) -
step— id: 125 (link) -
type— id: 187 (link) -
type— id: 206 (link)
Kind 4096 (26)
-
addPassage— id: 110 — Adds a new passage to the engine. The passage id should be unique, and the data can be anything that you want to store for the passage. If the passage already exists, it will be overwritten. (apps/library/src/engine/if-engine.ts :512) (link) -
addPassages— id: 117 — Like `addPassage`, but takes in a collection (apps/library/src/engine/if-engine.ts :517) (link) -
backward— id: 124 — Moves at least one step backwards in the state history. Does nothing if already at the first state snapshot. (apps/library/src/engine/if-engine.ts :527) (link) -
deleteAllSaveSlots— id: 127 (apps/library/src/engine/if-engine.ts :537) (link) -
deleteSaveSlot— id: 129 — Deletes any save data associated with the provided save slot. (apps/library/src/engine/if-engine.ts :557) (link) -
forward— id: 132 — Moves at least one step forward in the state history. Does nothing if already at the most recent state snapshot. (apps/library/src/engine/if-engine.ts :591) (link) -
fromJSON— id: 401 — Static method for reviving the class (packages/engine-class/src/types/userland-classes.ts :23) (link) -
getPassages— id: 144 — Returns an array of passages that match the specified tags. (apps/library/src/engine/if-engine.ts :634) (link) -
getSaves— id: 135 — Returns an object containing the data of all present saves (apps/library/src/engine/if-engine.ts :602) (link) -
getVisitCount— id: 157 — Gets all the times the passage has been visited by looping through each snapshot and initial state. Use this in place of `hasVisited(id)`, i.e `getVisitCount(id) > 0` (apps/library/src/engine/if-engine.ts :679) (link) -
init— id: 9 — Use this to initialize the engine (apps/library/src/engine/if-engine.ts :330) (link) -
loadFromExport— id: 160 — Can be used when directly loading a save from an exported save on disk (apps/library/src/engine/if-engine.ts :698) (link) -
loadFromSaveSlot— id: 163 (apps/library/src/engine/if-engine.ts :731) (link) -
loadRecentSave— id: 166 — Loads the most recent save, if any. Doesn't throw (apps/library/src/engine/if-engine.ts :759) (link) -
loadSaveFromData— id: 168 — Loads the save data from the provided save data object. This is used to load saves from the `getSaves()` method. (apps/library/src/engine/if-engine.ts :779) (link) -
navigateTo— id: 178 — Creates and moves the index over to a new snapshot with the given passage id (or the previous one) and returns a reference to it. This is essentially the way of linking between passages in the story. Yes, you can navigate to the same passage multiple times, and it will create a new snapshot each time. It's intended behavior. (apps/library/src/engine/if-engine.ts :902) (link) -
off— id: 200 — Unsubscribe from an event (apps/library/src/engine/if-engine.ts :948) (link) -
on— id: 181 — Subscribe to an event. (apps/library/src/engine/if-engine.ts :932) (link) -
registerClasses— id: 217 — Any custom classes stored in the story's state must be registered with this (apps/library/src/engine/if-engine.ts :960) (link) -
registerMigrators— id: 220 — Use this to register custom callbacks for migrating outdated save data (apps/library/src/engine/if-engine.ts :972) (link) -
reset— id: 228 — Clears all snapshot data and reverts to the initial state. Use this if you want the engine to essentially, start "afresh" (apps/library/src/engine/if-engine.ts :997) (link) -
saveToExport— id: 231 — For saves the need to exported out of the browser (apps/library/src/engine/if-engine.ts :1008) (link) -
saveToSaveSlot— id: 233 — Using the provided persistence adapter, this saves all vital data for the combined state, metadata, and current index (apps/library/src/engine/if-engine.ts :1051) (link) -
setAchievements— id: 238 — Immer-style producer for setting achievements If you need to replace the entire achievement object, *return a new object* (apps/library/src/engine/if-engine.ts :1101) (link) -
setSettings— id: 248 — Immer-style producer for setting settings If you need to replace the entire settings object, *return a new object* (apps/library/src/engine/if-engine.ts :1131) (link) -
setVars— id: 100 — Immer-style way of updating story variables Use this **solely** for setting values. If you must read a value, use `this.vars` **If you need to replace the entire state, *return a new object* instead of directly *assigning the value*** (apps/library/src/engine/if-engine.ts :447) (link)
Kind 524288 (7)
-
achievements— id: 236 (apps/library/src/engine/if-engine.ts :1089) (link) -
index— id: 258 — The current position in the state history that the engine is playing. This is used to determine the current state of the engine. READONLY VERSION (apps/library/src/engine/if-engine.ts :1158) (link) -
passage— id: 260 — Returns the passage data for the current state. If the passage does not exist, returns `null`. (apps/library/src/engine/if-engine.ts :1166) (link) -
passageId— id: 266 — Returns the id to the appropriate passage for the current state (apps/library/src/engine/if-engine.ts :1171) (link) -
random— id: 268 — Based off an internal PRNG, returns a random float between 0 and 1, inclusively (apps/library/src/engine/if-engine.ts :1176) (link) -
settings— id: 270 (apps/library/src/engine/if-engine.ts :1193) (link) -
vars— id: 272 — Returns a readonly copy of the current state of stored variables. May be expensive to calculate depending on the history of the story. (apps/library/src/engine/if-engine.ts :1200) (link)
Generated from src/generated/docs.json