Persisting State in TypeScript

Because the Typescript environment doesn’t allow global variables I’m not sure how I should be handling state that I want to exist for the duration of the environment running.

For example, in development sometimes I want to enable or disable a step of the custom authentication. I have an RPC that can be invoked from the developer console that can do this but how can I store the state i.e true/false because it can’t be in a global variable.

When an authentication occurs I need to know if I have to check the extra auth step or if I can skip it.

Any support would be greatly appreciated.

Thanks,
Wob.

Hello @Wobling,

Just use the storage engine with an object owned by the system user and have the RPC update the object’s state.

Hope this helps.

1 Like

Hi Sesposito,

Thanks, I did wonder if that was the route to go but wanted to get some clarification.

Thank you,
Wob.