Minimal Angular Slice Object Store State Service | Example

Ole Ersoy
Mar - 12  -  1 min
import { Injectable } from "@angular/core";
import { KeyObsValueReset, ObsValueReset, OStore, OStoreStart } from '@fireflysemantics/slice'
import { Observable } from "rxjs";

const START: OStoreStart = {
    IS_TOS_ACCEPTED: { value: false }
}

interface ISTART extends KeyObsValueReset {
    IS_TOS_ACCEPTED: ObsValueReset
}

@Injectable({
    providedIn: "root"
})
export class StateService {
    constructor() { }
    public OS: OStore<ISTART> = new OStore(START)
    public isTOSAccepted$:Observable<boolean> = this.OS.S.IS_TOS_ACCEPTED.obs
}