github.com/stampzilla/stampzilla-go@v2.0.0-rc9+incompatible/nodes/stampzilla-server/web/src/middlewares/schedules.js (about)

     1  import { write } from '../components/Websocket';
     2  
     3  const schedules = store => next => (action) => {
     4    const prev = store.getState().getIn(['schedules', 'list']);
     5    const result = next(action);
     6    const after = store.getState().getIn(['schedules', 'list']);
     7  
     8    if (!after.equals(prev) && action.type !== 'schedules_UPDATE') {
     9      write({
    10        type: 'update-schedules',
    11        body: after.toJS(),
    12      });
    13    }
    14    return result;
    15  };
    16  
    17  export default schedules;