當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。