• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript history.createBrowserHistory函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: makeHistoryDriver

export function makeHistoryDriver(
    options?: BrowserHistoryBuildOptions | History | MemoryHistory,
  ): HistoryDriver {
  let history: any;
  if (options && options.hasOwnProperty('createHref')) {
    history = options;
  } else {
    history = createBrowserHistory(options);
  }

  return function historyDriver(sink$: Stream<HistoryInput | string>) {
    return createHistory$(history, sink$);
  };
}
开发者ID:whitecolor,项目名称:cyclejs,代码行数:14,代码来源:drivers.ts


示例2: createBrowserHistory

import { createBrowserHistory, createMemoryHistory, createHashHistory, createLocation, Location, History, MemoryHistory } from 'history';
import * as LocationUtils from 'history/LocationUtils';
import * as PathUtils from 'history/PathUtils';
import * as DOMUtils from 'history/DOMUtils';
import * as ExecutionEnvironment from 'history/ExecutionEnvironment';

let input = { value: "" };

{
    let history: History<{some: 'state'}> = createBrowserHistory();

    // Listen for changes to the current location. The
    // listener is called once immediately.
    let unlisten = history.listen(function (location) {
        console.log(location.pathname);
    });

    // When you're finished, stop the listener.
    unlisten();

    // Push a new entry onto the history stack.
    history.push('/home');

    // Replace the current entry on the history stack.
    history.replace('/profile');

    // Push a new entry with state onto the history stack.
    history.push({
        pathname: '/about',
        search: '?the=search',
        state: { some: 'state' }
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:31,代码来源:history-tests.ts


示例3: goto

 static goto(routePath: string): History {
   const history = createBrowserHistory();
   history.push(`/${routePath}`);
   return history;
 }
开发者ID:nitrogenlabs,项目名称:nl-flux,代码行数:5,代码来源:InspectorActions.ts


示例4: createBrowserHistory

import { createBrowserHistory } from 'history'

const history = createBrowserHistory({
  basename: '/intern',
})

export default history
开发者ID:blindern,项目名称:intern,代码行数:7,代码来源:history.ts


示例5: combineReducers

import { createStore, combineReducers, applyMiddleware } from 'redux';
import { createBrowserHistory } from 'history';
import { syncHistory, routeReducer } from 'react-router-redux';

const reducer = combineReducers({ routing: routeReducer });

// Sync dispatched route actions to the history
const browserHistory = createBrowserHistory()
const reduxRouterMiddleware = syncHistory(browserHistory);
const createStoreWithMiddleware = applyMiddleware(reduxRouterMiddleware)(createStore);

const store = createStoreWithMiddleware(reducer);

// Required for replaying actions from devtools to
reduxRouterMiddleware.listenForReplays(store);
开发者ID:DmitryEfimenko,项目名称:DefinitelyTyped,代码行数:15,代码来源:react-router-redux-tests.ts


示例6: createBrowserHistory

import { createBrowserHistory } from 'history';

const history = createBrowserHistory();
export default history;
开发者ID:weiweiwitch,项目名称:third-lab,代码行数:4,代码来源:appHistory.ts


示例7: qhistory

import qhistory from 'qhistory';
import { createBrowserHistory } from 'history';
import * as qs from 'qs';

const history = qhistory(createBrowserHistory(), qs.stringify, qs.parse);

history.listen(location => {
  const query: { foo?: string } = location.query;
  if (query.foo) {
    const foo: string = query.foo;
  }
});

history.push({
  pathname: '/',
  query: {
    foo: 'bar'
  }
});
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:19,代码来源:qhistory-tests.ts


示例8: createBrowserHistory

import {createBrowserHistory} from "history";

export default createBrowserHistory();
开发者ID:langkilde,项目名称:fatbat,代码行数:3,代码来源:historyCreator.ts


示例9: createBrowserHistory

import './css/site.css';
import 'bootstrap';
import * as ko from 'knockout';
import { createBrowserHistory } from 'history';
import './webpack-component-loader';
import AppRootComponent from './components/app-root/app-root';
const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href')!;
const basename = baseUrl.substring(0, baseUrl.length - 1); // History component needs no trailing slash

// Load and register the <app-root> component
ko.components.register('app-root', AppRootComponent);

// Tell Knockout to start up an instance of your application
ko.applyBindings({ history: createBrowserHistory({ basename }), basename });

// Basic hot reloading support. Automatically reloads and restarts the Knockout app each time
// you modify source files. This will not preserve any application state other than the URL.
if (module.hot) {
    module.hot.accept();
    module.hot.dispose(() => ko.cleanNode(document.body));
}
开发者ID:juniwang,项目名称:rasg,代码行数:21,代码来源:boot.ts


示例10: require

import {createStore, applyMiddleware, compose} from "redux";
const History = require("history");
import {routerMiddleware as create_redux_router_middleware} from "react-router-redux";
const thunk = require("redux-thunk").default;

import CONFIG from "../../../shared/config";
import {all_reducers} from "./reducers";
import {AppState} from "./shape";
import {Action} from "./actions";

// tslint:disable-next-line
// https://github.com/ReactTraining/react-router/tree/dc2149ec0c63bfc95b71e40c81431e34cfbfeda9/packages/react-router-redux
export const history = History.createBrowserHistory();
const redux_router_middleware = create_redux_router_middleware(history);
const redux_router_store_enhancer = applyMiddleware(thunk, redux_router_middleware);

// tslint:disable-next-line
const glo = (window || global) as any;
// From: https://github.com/zalmoxisus/redux-devtools-extension#1-with-redux
let compose_enhancers = compose;

if (CONFIG.ENV_DEVELOPMENT && glo.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
    compose_enhancers = glo.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
        // Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
    });
}

export const app_store = createStore<AppState>(
    all_reducers,
    compose_enhancers(redux_router_store_enhancer)
);
开发者ID:AJamesPhillips,项目名称:napthr,代码行数:31,代码来源:store.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript history.createHashHistory函数代码示例发布时间:2022-05-25
下一篇:
TypeScript highlight.js.default类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap