strawberry icon indicating copy to clipboard operation
strawberry copied to clipboard

Global Shared Data/State

Open kalisjoshua opened this issue 1 year ago • 1 comments

Is there a way to "hide" the globally available strawberry object? I'd like to use this for a game and I am not figuring out how to hide access to the initialized reactive data object.

kalisjoshua avatar Oct 18 '23 14:10 kalisjoshua

You can kinda hide the reactive data object by calling sb.init inside a non global scope. But subsequent calls to sb.init returns the same object.

Will have to push an update that makes multiple calls to sb.init a no-op that returns undefined, the sb object would still be available though.


Possible solution https://github.com/18alantom/strawberry/pull/33 ∵ ESM modules don't share global state and imports aren't accessible from the console.

18alantom avatar Oct 23 '23 05:10 18alantom