mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2026-01-01 14:37:31 +00:00
Working React+Redux template
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Type definitions for history v1.13.1
|
||||
// Type definitions for history v2.0.0
|
||||
// Project: https://github.com/rackt/history
|
||||
// Definitions by: Sergey Buturlakin <http://github.com/sergey-buturlakin>
|
||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -17,21 +17,25 @@ declare namespace HistoryModule {
|
||||
type CreateHistoryEnhancer<T, E> = (createHistory: CreateHistory<T>) => CreateHistory<T & E>
|
||||
|
||||
interface History {
|
||||
listenBefore(hook: TransitionHook): Function
|
||||
listen(listener: LocationListener): Function
|
||||
listenBefore(hook: TransitionHook): () => void
|
||||
listen(listener: LocationListener): () => void
|
||||
transitionTo(location: Location): void
|
||||
pushState(state: LocationState, path: Path): void
|
||||
replaceState(state: LocationState, path: Path): void
|
||||
push(path: Path): void
|
||||
replace(path: Path): void
|
||||
push(path: LocationDescriptor): void
|
||||
replace(path: LocationDescriptor): void
|
||||
go(n: number): void
|
||||
goBack(): void
|
||||
goForward(): void
|
||||
createKey(): LocationKey
|
||||
createPath(path: Path): Path
|
||||
createHref(path: Path): Href
|
||||
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
||||
createPath(path: LocationDescriptor): Path
|
||||
createHref(path: LocationDescriptor): Href
|
||||
createLocation(path?: LocationDescriptor, action?: Action, key?: LocationKey): Location
|
||||
|
||||
/** @deprecated use a location descriptor instead */
|
||||
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
||||
/** @deprecated use location.key to save state instead */
|
||||
pushState(state: LocationState, path: Path): void
|
||||
/** @deprecated use location.key to save state instead */
|
||||
replaceState(state: LocationState, path: Path): void
|
||||
/** @deprecated use location.key to save state instead */
|
||||
setState(state: LocationState): void
|
||||
/** @deprecated use listenBefore instead */
|
||||
@@ -40,19 +44,42 @@ declare namespace HistoryModule {
|
||||
unregisterTransitionHook(hook: TransitionHook): void
|
||||
}
|
||||
|
||||
type HistoryOptions = Object
|
||||
type HistoryOptions = {
|
||||
getCurrentLocation?: () => Location
|
||||
finishTransition?: (nextLocation: Location) => boolean
|
||||
saveState?: (key: LocationKey, state: LocationState) => void
|
||||
go?: (n: number) => void
|
||||
getUserConfirmation?: (message: string, callback: (result: boolean) => void) => void
|
||||
keyLength?: number
|
||||
queryKey?: string | boolean
|
||||
stringifyQuery?: (obj: any) => string
|
||||
parseQueryString?: (str: string) => any
|
||||
basename?: string
|
||||
entries?: string | [any]
|
||||
current?: number
|
||||
}
|
||||
|
||||
type Href = string
|
||||
|
||||
type Location = {
|
||||
pathname: Pathname
|
||||
search: QueryString
|
||||
search: Search
|
||||
query: Query
|
||||
state: LocationState
|
||||
action: Action
|
||||
key: LocationKey
|
||||
basename?: string
|
||||
}
|
||||
|
||||
type LocationDescriptorObject = {
|
||||
pathname?: Pathname
|
||||
search?: Search
|
||||
query?: Query
|
||||
state?: LocationState
|
||||
}
|
||||
|
||||
type LocationDescriptor = LocationDescriptorObject | Path
|
||||
|
||||
type LocationKey = string
|
||||
|
||||
type LocationListener = (location: Location) => void
|
||||
@@ -67,11 +94,13 @@ declare namespace HistoryModule {
|
||||
|
||||
type QueryString = string
|
||||
|
||||
type TransitionHook = (location: Location, callback: Function) => any
|
||||
type Search = string
|
||||
|
||||
type TransitionHook = (location: Location, callback: (result: any) => void) => any
|
||||
|
||||
|
||||
interface HistoryBeforeUnload {
|
||||
listenBeforeUnload(hook: BeforeUnloadHook): Function
|
||||
listenBeforeUnload(hook: BeforeUnloadHook): () => void
|
||||
}
|
||||
|
||||
interface HistoryQueries {
|
||||
@@ -168,6 +197,18 @@ declare module "history/lib/actions" {
|
||||
|
||||
}
|
||||
|
||||
declare module "history/lib/DOMUtils" {
|
||||
export function addEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void;
|
||||
export function removeEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void;
|
||||
export function getHashPath(): string;
|
||||
export function replaceHashPath(path: string): void;
|
||||
export function getWindowPath(): string;
|
||||
export function go(n: number): void;
|
||||
export function getUserConfirmation(message: string, callback: (result: boolean) => void): void;
|
||||
export function supportsHistory(): boolean;
|
||||
export function supportsGoWithoutReloadUsingHash(): boolean;
|
||||
}
|
||||
|
||||
|
||||
declare module "history" {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Type definitions for react-router v2.0.0-rc5
|
||||
// Type definitions for react-router v2.0.0
|
||||
// Project: https://github.com/rackt/react-router
|
||||
// Definitions by: Sergey Buturlakin <http://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>
|
||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>, Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -195,6 +195,10 @@ declare namespace ReactRouter {
|
||||
interface IndexRedirectElement extends React.ReactElement<IndexRedirectProps> {}
|
||||
const IndexRedirect: IndexRedirect
|
||||
|
||||
interface RouterOnContext extends H.History {
|
||||
setRouteLeaveHook(route: PlainRoute, hook?: RouteHook): () => void;
|
||||
isActive(pathOrLoc: H.LocationDescriptor, indexOnly?: boolean): boolean;
|
||||
}
|
||||
|
||||
/* mixins */
|
||||
|
||||
@@ -220,6 +224,7 @@ declare namespace ReactRouter {
|
||||
listenBeforeLeavingRoute(route: PlainRoute, hook: RouteHook): void
|
||||
match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void
|
||||
isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean
|
||||
setRouteLeaveHook(route: PlainRoute, callback: RouteHook): void
|
||||
}
|
||||
|
||||
function useRoutes<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryRoutes>
|
||||
@@ -447,6 +452,7 @@ declare module "react-router" {
|
||||
export type RouterListener = ReactRouter.RouterListener
|
||||
export type RouterState = ReactRouter.RouterState
|
||||
export type HistoryBase = ReactRouter.HistoryBase
|
||||
export type RouterOnContext = ReactRouter.RouterOnContext
|
||||
|
||||
export {
|
||||
Router,
|
||||
|
||||
Reference in New Issue
Block a user