devicescript
devicescript copied to clipboard
Support for json in flash?
Read only json loaded directly from flash?
- array of literals in flash? number[]
you can do hex `00 01 ...`
; what use case do you have in mind?
Say i want to some readonly configuration data encoded as JSON. It would be great to have it stored in flash and not use head at runtime.
const configThatNeverChagnes = json`{
"adsfasf": "sdfsdf"
}`
I guess it would be more like
const cfg = Object.freeze({ "foo": 1 })
or maybe Object.deepFreeze()
.
I don't think this is critical though...
In MakeCode, we've had several instances where people had massive array of numbers to implement a driver. These arrays we using heap for now good reason. I would be good to be able to encode these kind of lookup tables in flash.... So maybe not object but something like number[]
I guess we could have Object.freeze([1, 2, 3])
and Object.freeze(new Uint32Array([1, 2, 3]))
. Anyway, in future...