mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-25 11:11:46 +08:00
@@ -0,0 +1,18 @@
|
||||
/// <reference path="satnav.d.ts" />
|
||||
Satnav({})
|
||||
.navigate({
|
||||
path: 'product/{required}/?{optional}',
|
||||
directions: (params) => {
|
||||
// Logic for product route
|
||||
console.log(params.required);
|
||||
console.log(params.hasOwnProperty('optional'));
|
||||
}
|
||||
})
|
||||
.otherwise('/product/1')
|
||||
.change(function (hash, params, old) {
|
||||
// Logic for any change
|
||||
console.log(hash);
|
||||
console.log(params);
|
||||
console.log(old);
|
||||
})
|
||||
.go(); //Resolve current route
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for satnav
|
||||
// Project: https://github.com/f5io/satnav-js
|
||||
// Definitions by: Christian Holm Diget <https://github.com/DotNetNerd>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare type Callback = () => void;
|
||||
|
||||
interface ISatnavOptions {
|
||||
html5?: boolean,
|
||||
force?: boolean,
|
||||
poll?: number,
|
||||
matchAll?: boolean
|
||||
}
|
||||
|
||||
interface INavigationOptions {
|
||||
path?: string,
|
||||
directions?: (params : any) => any,
|
||||
title?: string | Callback
|
||||
}
|
||||
|
||||
interface ISatnav {
|
||||
navigate(navigationOptions: INavigationOptions): ISatnav;
|
||||
otherwise(route: string): ISatnav;
|
||||
change(onChange: (hash: string, params: any, old: any) => any): ISatnav;
|
||||
go(): ISatnav;
|
||||
}
|
||||
|
||||
declare function Satnav(options?: ISatnavOptions): ISatnav;
|
||||
Reference in New Issue
Block a user