Skip to content

Data API

MikeyTheA edited this page Jun 26, 2024 · 1 revision

Data API

Here you will see all functions available with the data and globalData keyword, this API is used to transfer data between scripts and mods

getData(key, init, persistent)

  • key is the unique key for the data
  • init is what it will be set to if it doesn't exist yet
  • persistent is true if you want this data to stay after refreshing the page, do not put just about anything here, as cyclic objects will break saving, such as including any scene from PokeRogue, which you would have no point in doing anyway
  • returns the value stored

setData(key, value, persistent)

  • key is the unique key for the data
  • value is what it will set it to
  • persistent is true if you want this data to stay after refreshing the page, do not put just about anything here, as cyclic objects will break saving, such as including any scene from PokeRogue, which you would have no point in doing anyway

getAccess(key, init, persistent)

  • key is the unique key for the data
  • init is what it will be set to if it doesn't exist yet
  • persistent is true if you want this data to stay after refreshing the page, do not put just about anything here, as cyclic objects will break saving, such as including any scene from PokeRogue, which you would have no point in doing anyway
  • returns a function which returns the value or changes it if the value field is filled, this is mostly to be used with ImGui objects as they need an access function

addListener(key, init, listener, persistent)

  • key is the unique key for the data
  • init is what it will be set to if it doesn't exist yet
  • listener is a function to be executed when this data point gets changed
  • persistent is true if you want this data to stay after refreshing the page, do not put just about anything here, as cyclic objects will break saving, such as including any scene from PokeRogue, which you would have no point in doing anyway