Skip to content

Support subscriptions #2

@wxnet2013

Description

@wxnet2013
store.model({
  name: 'filter',
  state: {},
  reducers:  {
    change(state) { return state }
  },
  pipes:  {
   getData(action$) { return action$ }
  },
});

store.model({
  name: 'chart',
  state: {},
  reducers:  {
    add(state) { return state }
  },
  subscriptions: {
    model(source, { dispatch }) {
      source('filter/change').subscribe(() => {
        dispatch({ type: 'chart/add' });
       });
     },
  }
});

store.model({
  name: 'table',
  state: {},
  reducers:  {
    add(state) { return state }
  },
  subscriptions: {
    model(source, { dispatch }) {
      source('filter/change').subscribe(() => {
        dispatch({ type: 'table/add' });
      });
       source('filter/getData').subscribe(() => {
        dispatch({ type: 'table/add' });
       });
       source('filter/getData/end').subscribe(() => {
        dispatch({ type: 'table/add' });
       });
     },
     key(source,  { dispatch }) {
       source('⌘+up, ctrl+up').subscribe(() => {
         dispatch({ type: 'table/add' });
       });
    },
    mouse(source , { dispatch }) {
       source('left').subscribe(() => {
           dispatch({ type: 'table/add' });
       });
    },
    socket(source, { dispatch }) {},
    router(source, { dispatch }) {},
  }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions