TalkingData / rxloop-loading

rxloop loading plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rxloop-loading

https://github.com/TalkingData/rxloop/tree/master/packages/loading

rxloop loading plugin

Usage

import rxloop from '@rxloop/core';
import loading from '@rxloop/loading';

const app = rxloop({
  plugins: [ loading() ],
});

app.model({
  name: 'modelA',
  state: {
    a: 1,
  },
  reducers: {
    add(state) {
      return state;
    },
  },
  pipes: {
    getData(action$) {
      return action$.pipe(
        mapTo({
          type: 'add',
        }),
      );
    },
    setData(action$) {
      return action$.pipe(
        mapTo({
          type: 'add',
        }),
      );
    },
  },
});

app.stream('modelA').subscribe((state) => {
  console.log(state.loading.getData);
});

app.stream('loading').subscribe((state) => {
  console.log(state);
    // {
    //   pipes: {
    //     modelA: {
    //       getData: false,
    //       getDataCounter: 0,
    //       setData: false,
    //       setDataCounter: 0,
    //     },
    //   },
    // }
});

About

rxloop loading plugin

License:MIT License


Languages

Language:JavaScript 88.0%Language:Shell 12.0%