Getting a Snapshot of a Slice Object Store Value | Task

Ole Ersoy
Mar - 31  -  1 min

Scenario

We've created a minimal Slice Object Store ( OStore) and we want to get a snapshot of the current IS_AUTHENTICATED value.

This is the object store implmentation:

import { ObsValueReset, OStore, OStoreStart } from "@fireflysemantics/slice";

const START: OStoreStart = {
  IS_AUTHENTICATED: { value: false }
};

interface ISTART {
  IS_AUTHENTICATED: ObsValueReset;
}

const OS: OStore<ISTART> = new OStore(START);

Approach

const snapshot = OS.snapshot(OS.S.IS_AUTHENTICATED);

Demo