当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript redux-devTools.persistState函数代码示例

本文整理汇总了TypeScript中redux-devTools.persistState函数的典型用法代码示例。如果您正苦于以下问题:TypeScript persistState函数的具体用法?TypeScript persistState怎么用?TypeScript persistState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了persistState函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getStore

export default function getStore(initialState?:any){

	const enhancer = compose
		( applyMiddleware
			( reduxImmutableStateInvariant()
			, thunk
			)
		//, getDevTools()
		, DevTools.instrument()
		, persistState(getDebugSessionKey()
		)
	);

	const store = createStore
		( rootReducer
		, initialState
		, enhancer
		);

	if(module.hot){
		module.hot.accept
			( '../actions'
			, () => store.replaceReducer(require('../actions').reducer)
			);
	}

	return store;
}
开发者ID:Xananax,项目名称:typescript-hmr-boilerplate,代码行数:28,代码来源:configureStore.dev.ts

示例2: routerMiddleware

import thunk from 'redux-thunk';
import DevTools from '../containers/devTools';
import { rootReducer } from '../reducers';
import { hashHistory } from 'react-router';
import { persistState } from 'redux-devtools';
import { routerMiddleware } from 'react-router-redux';
import { createStore, applyMiddleware, compose } from 'redux';
import * as createLogger from 'redux-logger';
import { initialState } from './props';
const router = routerMiddleware(hashHistory);
// create logger
const logger = createLogger({
    level: 'info',
    collapsed: true,
});

const enhancer = compose(
    applyMiddleware(thunk, router, logger),
    DevTools.instrument(),
    persistState(
        window.location.href.match(
            /[?&]debug_session=([^&]+)\b/
        ))
)

export const store = createStore(rootReducer, initialState, applyMiddleware(thunk));
开发者ID:thehachez,项目名称:maduk,代码行数:26,代码来源:store.ts

示例3: enhance

import thunkMiddleware from 'redux-thunk'
import { createStore, applyMiddleware, compose } from 'redux'
import {reducer,state} from '../apps/data'
import { enhance } from '../apps/Root/DevTools';
import {persistState} from 'redux-devtools';  

const enhancer = compose
	( applyMiddleware
		( thunkMiddleware
		//, createLogger()
		)
	, enhance()
	, persistState(getDebugSessionKey())
	);

export default function configureStore(initialState=state){
	const store = createStore
		( reducer
		, state
		, enhancer
		);

	if (module.hot) {
		module.hot.accept('../apps/data', () => store.replaceReducer
			( require('../apps/data').reducer
			)
		);
	}

	return store;
}
开发者ID:Xananax,项目名称:actionsreducer,代码行数:31,代码来源:store.dev.ts

示例4: createLogger

import rootReducer from '../reducers';
import DevTools from '../containers/DevTools';

const logger = createLogger({
  level: 'info',
  collapsed: true,
});

const router = routerMiddleware(hashHistory);

const enhancer = compose(
  applyMiddleware(thunk, router, logger),
  DevTools.instrument(),
  persistState(
    new String(window.location.href.match(
      /[?&]debug_session=([^&]+)\b/
    )).toString()
  )
);

export default function configureStore(initialState) {
  const store = createStore(rootReducer, initialState, enhancer);

  let extensionModule: NodeModule & {hot?} = module;
  if (extensionModule.hot !== undefined) {
    extensionModule.hot.accept('../reducers', () =>
      store.replaceReducer(require('../reducers')) // eslint-disable-line global-require
    );
  }

  return store;
开发者ID:Jack-Q,项目名称:electron-react-boilerplate,代码行数:31,代码来源:configureStore.development.ts


注:本文中的redux-devTools.persistState函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。