TurboWarp / scratch-vm

Scratch VM with a JIT compiler and more features
https://turbowarp.org/
Mozilla Public License 2.0
75 stars 72 forks source link

Extension storage #179

Closed GarboMuffin closed 9 months ago

GarboMuffin commented 9 months ago

There are two kinds of storage:

(note that this is a different metaphor than what Scratch uses for variables, where global variables are stored on the stage which itself just a sprite)

both are saved in project.json (or sprite.json, when exporting a single sprite) and thus must be any JSON-serializable value

to clear the data, use the delete operator or set the data to null/undefined

you are intended to index into extensionStorage with your extension's id; if you don't then your data won't be saved (it removes unused extensions)

GarboMuffin commented 9 months ago

currently there are no helper methods, it's just a raw object you can read and write to. that can change if you want (eg. getOrDefault())

LilyMakesThings commented 9 months ago

This is precisely what I'm after

yuri-kiss commented 9 months ago

same

GarboMuffin commented 9 months ago

nobody quite answered whether they want any helpers so i assume you dont

yuri-kiss commented 9 months ago

nobody quite answered whether they want any helpers so i assume you dont

poop, yeah we forgot

LilyMakesThings commented 9 months ago

i'm good without helpers so it ain't a big deal