Creating Proxies to Slice Object Store Observables | Task

Ole Ersoy
Mar - 29  -  1 min

Scenario

We model IS_AUTHENTICATED in our Firefly Semantics Slice Object Store (OStore).

const START: OStoreStart = {
  IS_AUTHENTICATED: { value: false }
};
interface ISTART {
  IS_AUTHENTICATED: ObsValueReset;
}
let OS: OStore<ISTART> = new OStore(START);

And we can access the corresponding Observable like this:

OS.S.IS_AUTHENTICATED.obs

But we would rather access it like this:

isAuthenticated$

Approach

const isAuthenticated$: Observable<boolean> = OS.S.IS_AUTHENTICATED.obs;

Demo