How to use the aurelia-store.MiddlewarePlacement.After function in aurelia-store

To help you get started, we’ve selected a few aurelia-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 timfish / aurelia-electron-webpack / src / electron-store.ts View on Github external
constructor(initialState: T, options?: Partial) {
    super(initialState, options);

    if (process.type === 'renderer') {
      this.registerMiddleware(toMainMiddleware, MiddlewarePlacement.After);
      // Listen for actions from the main process
      ipcRenderer.on(IPC_KEY, (_: Electron.Event, action: string, ...params: any[]) => {
        this.dispatch(action, ...params);
      });
    } else {
      this.registerMiddleware(toRendererMiddleware, MiddlewarePlacement.After);
      // Listen for actions from a renderer process
      ipcMain.on(IPC_KEY, (_: Electron.Event, action: string, ...params: any[]) => {
        this.dispatch(action, ...params);
      });
    }

    this.registerAction(ACTION_SET_STATE, setStateFromIPC);
  }

aurelia-store

Aurelia single state store based on RxJS

MIT
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis