Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SaveManager

Hierarchy

  • SaveManager

Implements

Index

Methods

compressSave

  • compressSave(slot: number, saveObject: SaveObject, exporting?: boolean): void
  • Parameters

    • slot: number
    • saveObject: SaveObject
    • Default value exporting: boolean = false

    Returns void

decompressSave

  • decompressSave(slot: number, saveObject: SaveObject, importing?: boolean): void
  • Parameters

    • slot: number
    • saveObject: SaveObject
    • Default value importing: boolean = false

    Returns void

deleteAllData

  • deleteAllData(): Promise<void>

deleteAllSlots

  • deleteAllSlots(): Promise<boolean>

deleteSlot

  • deleteSlot(slot: number): Promise<boolean>
  • Parameters

    • slot: number

    Returns Promise<boolean>

exportSave

getFirstFreeSlot

  • getFirstFreeSlot(): Promise<number | undefined>
  • Returns the index of the first free slot

    Returns Promise<number | undefined>

getGameStateAsJson

  • getGameStateAsJson(cleanup?: boolean): string
  • Parameters

    • Default value cleanup: boolean = true

    Returns string

getMostRecentSlot

  • getMostRecentSlot(): Promise<number>

getSaveCount

  • getSaveCount(): Promise<number>
  • Returns the number of filled slots

    Returns Promise<number>

getSlots

  • getSlots(): Promise<boolean[]>
  • Returns an array where the index is the slot number, and the value is whether or not the slot is filled

    Returns Promise<boolean[]>

getUsedSlots

  • getUsedSlots(): Promise<number[]>
  • Returns the indices of the used slots

    Returns Promise<number[]>

getUsedSlotsSorted

  • Gets the used slots, ordered by one of a few properties of the saveData in that slot

    Parameters

    Returns Promise<number[]>

importSave

  • importSave(slot: number, saveObject: SaveObject | string): Promise<number>
  • Returns the number of bytes the save takes up, or undefined, if an error occurs

    Parameters

    Returns Promise<number>

initialize

  • initialize(): Promise<void>

isEnabled

  • isEnabled(): boolean

isSlotUsed

  • isSlotUsed(slot: number): Promise<boolean>
  • Returns whether or not the slot is used

    Parameters

    • slot: number

    Returns Promise<boolean>

load

  • load(slot: number): Promise<boolean>
  • Returns whether or not it succeeded

    Parameters

    • slot: number

    Returns Promise<boolean>

loadPartial

loadPartialData

  • loadPartialData(saveObject: SaveObject, object: any, key: string, saveObjectKey?: string, skipCompression?: boolean, importing?: boolean): void
  • Parameters

    • saveObject: SaveObject
    • object: any
    • key: string
    • Default value saveObjectKey: string = key
    • Default value skipCompression: boolean = false
    • Default value importing: boolean = false

    Returns void

loadPartialDataInside

  • loadPartialDataInside(saveObject: SaveObject, saveObjectKey: string, key?: string | undefined): any

save

  • save(slot: number, unloading?: boolean): Promise<ISaveInfo>
  • Returns a tuple [bytes: number, saveObject: SaveObject]

    Parameters

    • slot: number
    • Default value unloading: boolean = false

    Returns Promise<ISaveInfo>

savePartialData

  • savePartialData(slot: number, object: any, key: string, saveObjectKey: string): Promise<number>
  • Returns the number of bytes the save takes up

    Parameters

    • slot: number
    • object: any
    • key: string
    • saveObjectKey: string

    Returns Promise<number>

savePartialDataInside

  • savePartialDataInside(slot: number, saveObjectKey: string, key: string, value: any): Promise<number>
  • Returns the number of bytes the save takes up

    Parameters

    • slot: number
    • saveObjectKey: string
    • key: string
    • value: any

    Returns Promise<number>

Generated using TypeDoc