0.3.0 • Published 5 years ago

smr-plugin-loading v0.3.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

smr-plugin-loading

a plugin of simple-module-redux

Installation

npm install smr-plugin-loading

Usage

use smrCreateStore

import { smrCreateStoreWithPlugin } from 'simple-module-redux';
import withLoading, { LoadingModule } from 'smr-plugin-loading';
import reduxLogger from 'redux-logger';
import modules from './modules';
modules[LoadingModule.name] = LoadingModule;
const smrCreateStore = smrCreateStoreWithPlugin([withLoading()]);
const store = smrCreateStore(
  modules,
  preloadedState,
  applyMiddleware(reduxLogger)
);

use smrEnhancer

import { createStore, compose } from 'redux';
import { smrEnhancerWidthPlugin } from 'simple-module-redux';
import withLoading, { LoadingModule } from 'smr-plugin-loading';
import reduxLogger from 'redux-logger';
import modules from './modules';
modules[LoadingModule.name] = LoadingModule;
const smrEnhancer = smrEnhancerWidthPlugin([withLoading()]);
const store = createStore(
  modules,
  preloadedState,
  compose(
    smrEnhancer,
    applyMiddleware(reduxLogger)
  )
);

use smrMiddleware & generateReducer

import { createStore, applyMiddleware } from 'redux';
import { smrMiddleware, generateReducer } from 'simple-module-redux';
import withLoading, { LoadingModule } from 'smr-plugin-loading';
import reduxLogger from 'redux-logger';
import modules from './modules';
modules[LoadingModule.name] = LoadingModule;
const reducer = generateReducer(modules, [withLoading()]);
const store = createStore(
  reducer,
  preloadedState,
  applyMiddleware(smrMiddleware, reduxLogger)
);

config

const useLoading = withLoading(config);

const config = { whitelist: ['foo/bar'] };
// or
const config = { blacklist: ['foo/bar'] };
// or
const config = {
  whitelist: actionName => {
    actionName.indexOf('foo') > 0;
  }
};
// or
const config = {
  blacklist: actionName => {
    actionName.indexOf('foo') > 0;
  }
};
0.3.0

5 years ago

0.2.1

5 years ago

0.1.10-alpha.0

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.12

5 years ago