How to use the @ngxs/store.getValue function in @ngxs/store

To help you get started, we’ve selected a few @ngxs/store examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ngxs-labs / data / src / lib / services / ngxs-data-storage-engine.ts View on Github external
tap((nextState) => {
                for (const [provider] of this.entries) {
                    const prevData: Any = getValue(states, provider.path);
                    const newData: Any = getValue(nextState, provider.path);
                    if (prevData !== newData || isInitAction) {
                        const engine: DataStorageEngine = this.exposeEngine(provider);

                        try {
                            const data: Any = this.serialize(newData, provider);
                            const key: string = this.ensureKey(provider);
                            engine.setItem(key, data);
                            NgxsDataStorageEngine.keys.set(key);
                        } catch (e) {
                            console.error(`${NGXS_DATA_EXCEPTIONS.NGXS_PERSISTENCE_SERIALIZE}:::${provider.path}`);
                        }
                    }
                }
            })
        );
github ngxs-labs / data / src / lib / services / ngxs-data-storage-engine.ts View on Github external
tap((nextState) => {
                for (const [provider] of this.entries) {
                    const prevData: Any = getValue(states, provider.path);
                    const newData: Any = getValue(nextState, provider.path);
                    if (prevData !== newData || isInitAction) {
                        const engine: DataStorageEngine = this.exposeEngine(provider);

                        try {
                            const data: Any = this.serialize(newData, provider);
                            const key: string = this.ensureKey(provider);
                            engine.setItem(key, data);
                            NgxsDataStorageEngine.keys.set(key);
                        } catch (e) {
                            console.error(`${NGXS_DATA_EXCEPTIONS.NGXS_PERSISTENCE_SERIALIZE}:::${provider.path}`);
                        }
                    }
                }
            })
        );
github xmlking / ngx-starter-kit / libs / socketio-plugin / src / lib / websocket-handler.ts View on Github external
msg => {
        const type = getValue(msg, config.typeKey);
        if (!type) {
          throw new Error(`Type ${type} not found on message`);
        }
        store.dispatch({ ...msg, type });
      },
      err => store.dispatch(new WebsocketMessageError(err)),
github ngxs / store / packages / form-plugin / src / directive.ts View on Github external
    return this._store.select(state => getValue(state, path)).pipe(takeUntil(this._destroy$));
  }
github ngxs / store / packages / websocket-plugin / src / websocket-handler.ts View on Github external
next: (message: any) => {
        const type = getValue(message, this.typeKey);
        if (!type) {
          throw new TypeKeyPropertyMissingError(this.typeKey);
        }
        this.store.dispatch({ ...message, type });
      },
      error: (error: any) => {
github ngxs / store / packages / form-plugin / src / directive.ts View on Github external
      .selectOnce(state => getValue(state, this.path))
      .subscribe(() => {