當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript redux-devtools-extension.composeWithDevTools函數代碼示例

本文整理匯總了TypeScript中redux-devtools-extension.composeWithDevTools函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript composeWithDevTools函數的具體用法?TypeScript composeWithDevTools怎麽用?TypeScript composeWithDevTools使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了composeWithDevTools函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: configureStore

export default function configureStore(): Store<IApplicationState> {
    const epicMiddleware = createEpicMiddleware()

    const middlewares = [
        epicMiddleware,
        notificationsMiddleware,
    ]

    const store = createStore(
        rootReducer,
        composeWithDevTools(
            applyMiddleware(...middlewares)
        )
    )

    epicMiddleware.run(rootEpic)

    return store
}
開發者ID:manishshanker,項目名稱:wiremock-ui,代碼行數:19,代碼來源:configureStore.ts

示例2: createRouter

export const configureStore = (
  initialState?: GenericObject,
  initialEntries?: GenericObject,
) => {
  const options = { initialEntries };
  const { reducer, middleware, firstRoute } = createRouter(appRoutes, options);
  const epicMiddleware = createEpicMiddleware();

  const middlewares = applyMiddleware(middleware, epicMiddleware);
  const enhancers = composeWithDevTools(middlewares);

  const store = createStore(
    createRootReducer({ page: pageReducer, location: reducer }),
    initialState,
    enhancers,
  );
  epicMiddleware.run(createRootEpic() as any);

  return { store, firstRoute };
};
開發者ID:KTruong888,項目名稱:resources,代碼行數:20,代碼來源:store.utils.ts

示例3: configureStore

export default function configureStore(preloadedState: object) {
  const middlewares: Middleware[] = [
    fileHandlerMiddleware,
    loggerMiddleware,
    subtitleMiddleware,
  ];
  const middlewareEnhancer = applyMiddleware(...middlewares);

  const store = createStore(
    rootReducer,
    preloadedState,
    composeWithDevTools(middlewareEnhancer),
  );

  if (process.env.NODE_ENV !== 'production' && module.hot) {
    module.hot.accept('./rootReducer', () => store.replaceReducer(rootReducer));
  }

  return store;
}
開發者ID:Heeryong-Kang,項目名稱:jamak,代碼行數:20,代碼來源:configure.ts

示例4: configureStore

export default function configureStore(
  initialState: any,
): Store<IState> {
  const middlewares = [thunk];
  const middlewareEnhancer = composeWithDevTools(applyMiddleware(...middlewares));

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

  if (process.env.NODE_ENV !== 'production') {
    if (module.hot) {
      module.hot.accept('../reducers/rootReducer', () => {
        store.replaceReducer(rootReducer);
      });
    }
  }

  return store;
}
開發者ID:olvnikon,項目名稱:fx-trading-app-ts,代碼行數:22,代碼來源:configureStore.ts

示例5: configureStore

export default function configureStore(
  referenceDataService,
  blotterService,
  pricingService,
  analyticsService,
  compositeStatusService,
  executionService,
  openFin
) {
  const middleware = epicMiddleware(
    referenceDataService,
    blotterService,
    pricingService,
    analyticsService,
    compositeStatusService,
    executionService,
    openFin
  )

  const store = createStore(rootReducer, composeWithDevTools(applyMiddleware(middleware)))
  persistStore(store)

  return store
}
開發者ID:carlosrfernandez,項目名稱:ReactiveTraderCloud,代碼行數:24,代碼來源:configureStore.ts

示例6: composeWithDevTools

import { createStore, applyMiddleware, DeepPartial } from "redux";
import thunk from "redux-thunk";
import { composeWithDevTools } from "redux-devtools-extension";
import reducer from "./reducers";
import mediaMiddleware from "./mediaMiddleware";
import { merge } from "./utils";
import { UPDATE_TIME_ELAPSED, STEP_MARQUEE } from "./actionTypes";
import Media from "./media";
import Emitter from "./emitter";
import { Extras, Dispatch, Action, AppState, Middleware } from "./types";

// TODO: Move to demo
const compose = composeWithDevTools({
  actionsBlacklist: [UPDATE_TIME_ELAPSED, STEP_MARQUEE],
});

export default function(
  media: Media,
  actionEmitter: Emitter,
  customMiddlewares: Middleware[] = [],
  stateOverrides: DeepPartial<AppState> | undefined,
  extras: Extras
) {
  let initialState;
  if (stateOverrides) {
    initialState = merge(
      reducer(undefined, { type: "@@init" }),
      stateOverrides
    );
  }
開發者ID:captbaritone,項目名稱:winamp2-js,代碼行數:30,代碼來源:store.ts

示例7: composeWithDevTools

import {
  Action,
  Middleware,
  Reducer,
  applyMiddleware,
  createStore
} from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';

const composeEnhancers = composeWithDevTools();

const reducer: Reducer<{}> = () => ({});
const middleware: Middleware[] = [];
const store = createStore(reducer, composeEnhancers(
  applyMiddleware(...middleware)
));

const store2 = createStore(reducer, composeWithDevTools({
  serialize: {
    options: {
      undefined: true,
      function: (fn: any) => fn.toString()
    }
  }
}));

const store3 = createStore(reducer, composeWithDevTools({
  serialize: {
    replacer: (key, value) => 'foo'
  }
}));
開發者ID:gilamran,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:redux-devtools-extension-tests.ts

示例8: composeWithDevTools

import { createStore, compose, applyMiddleware, Middleware } from 'redux';
// import { createEpicMiddleware } from 'redux-observable';
import { composeWithDevTools } from 'redux-devtools-extension';

import createRootReducer from './app.reducers';

const middlewares: Array<Middleware> = [];
const enhancers =
  process.env.REACT_APP_ENV !== 'prod'
    ? composeWithDevTools(applyMiddleware(...middlewares))
    : compose(applyMiddleware(...middlewares));

export const createNewStore = () => {
  return createStore(createRootReducer(), {}, compose(enhancers));
};

export default createNewStore;
開發者ID:KTruong888,項目名稱:resources,代碼行數:17,代碼來源:app.store.ts

示例9: createStore

import { createStore, combineReducers, applyMiddleware } from "redux";
import { reducer as greetingReducer } from "./greeting";
import thunk from "redux-thunk";
import { composeWithDevTools } from "redux-devtools-extension";

export type State = {
  greeting: string;
};

const store = createStore(
  combineReducers({
    greeting: greetingReducer
  }),
  composeWithDevTools(applyMiddleware(thunk))
);

export default store;
開發者ID:DJCordhose,項目名稱:react-workshop,代碼行數:17,代碼來源:store.ts

示例10: userReducer

import { applyMiddleware, combineReducers, compose, createStore, Middleware, MiddlewareAPI  } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunk from 'redux-thunk';

import { UserActionTypes, FactActionTypes } from './actions';
import { factReducer, userReducer } from './reducers';
import { AppState } from './models';
import { initialAppState } from './models/app';

type ActionTypes = UserActionTypes | FactActionTypes;

const appReducer = (state: AppState = initialAppState, action: ActionTypes): AppState => {
    return {
        userState: userReducer(state.userState, action),
        actualState: factReducer(state.actualState, action)
    };
};

// thunkMiddleware enables async actions (like fetch or promises)
// authRefreshMiddleware dispatches a thunk, so put it before thunk
const store = createStore(appReducer, initialAppState, composeWithDevTools(
            applyMiddleware(thunk),
));

export default store;
開發者ID:pfbtgom,項目名稱:kbase,代碼行數:25,代碼來源:store.ts


注:本文中的redux-devtools-extension.composeWithDevTools函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。