当前位置: 首页>>代码示例>>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;未经允许,请勿转载。