Merge pull request #29951 from javnov/master

Expose globalHistory field as @reach/router does
This commit is contained in:
Daniel Rosenwasser
2018-10-29 16:35:13 -07:00
committed by GitHub
+12 -4
View File
@@ -8,16 +8,22 @@ import * as React from "react";
import { Location as HLocation } from "history";
export type WindowLocation = Window["location"] & HLocation;
export type HistoryActionType = "PUSH" | "POP";
export type HistoryLocation = WindowLocation & { state?: any };
export interface HistoryListenerParameter {
location: HistoryLocation;
action: HistoryActionType;
}
export type HistoryListener = (parameter: HistoryListenerParameter) => void;
export type HistoryUnsubscribe = () => void;
export interface History {
readonly location: string;
readonly location: HistoryLocation;
readonly transitioning: boolean;
listen: (listener: HistoryListener) => HistoryUnsubscribe;
navigate: NavigateFn;
}
export type HistoryListener = () => void;
export type HistoryUnsubscribe = () => void;
export class Router extends React.Component<RouterProps> { }
export interface RouterProps {
@@ -147,3 +153,5 @@ export interface RedirectRequest {
export function isRedirect(error: any): error is RedirectRequest;
export function redirectTo(uri: string): void;
export const globalHistory: History;