mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 10:35:22 +08:00
add methods types to Navigo and update the version
This commit is contained in:
10
types/navigo/index.d.ts
vendored
10
types/navigo/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for navigo 4.0
|
||||
// Type definitions for navigo 6.0
|
||||
// Project: https://github.com/krasimir/navigo
|
||||
// Definitions by: Adrian Ehrsam <https://github.com/aersamkull>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -20,7 +20,7 @@ interface GenericHooks {
|
||||
after?(params?: Params): void;
|
||||
}
|
||||
|
||||
type RouteHandler = ((parametersObj: any, query: string) => void) | { as: string; uses(parametersObj: any): void };
|
||||
type RouteHandler = ((params: Params, query: string) => void) | { as: string; uses(params: Params, query: string): void };
|
||||
|
||||
declare class Navigo {
|
||||
/**
|
||||
@@ -44,6 +44,8 @@ declare class Navigo {
|
||||
|
||||
generate(path: string, params?: any): string;
|
||||
|
||||
getLinkPath(link: any): any;
|
||||
|
||||
resolve(currentURL?: string): boolean;
|
||||
|
||||
link(path: string): string;
|
||||
@@ -52,9 +54,11 @@ declare class Navigo {
|
||||
|
||||
disableIfAPINotAvailable(): void;
|
||||
|
||||
historyAPIUpdateMethod(method?: string): void;
|
||||
|
||||
hooks(hooks: GenericHooks): void;
|
||||
|
||||
pause(): void;
|
||||
pause(change?: boolean): void;
|
||||
|
||||
resume(): void;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ router
|
||||
.resolve();
|
||||
|
||||
router
|
||||
.on('/user/:id/:action', (params: { id: string; action: string }) => {
|
||||
.on('/user/:id/:action', (params: Params) => {
|
||||
// If we have http://site.com/user/42/save as a url then
|
||||
// params.id = 42
|
||||
// params.action = save
|
||||
@@ -64,7 +64,7 @@ router
|
||||
.resolve();
|
||||
|
||||
router
|
||||
.on('/user/:id/:action', (params: { id: string; action: string }, query: string) => {
|
||||
.on('/user/:id/:action', (params: Params, query: string) => {
|
||||
// If we have http://site.com/user/42/save?answer=42 as a url then
|
||||
// params.id = 42
|
||||
// params.action = save
|
||||
@@ -117,6 +117,11 @@ router.pause();
|
||||
router.navigate('/en/products');
|
||||
router.resume(); // or .pause(false)
|
||||
|
||||
router.pause();
|
||||
router.historyAPIUpdateMethod('replaceState');
|
||||
router.disableIfAPINotAvailable();
|
||||
router.resume();
|
||||
|
||||
router.on(
|
||||
'/user/edit',
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user