forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
history.d.ts
61 lines (47 loc) · 1.63 KB
/
history.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Type definitions for History.js 1.8.0
// Project: https://github.com/browserstate/history.js
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Gidon Junge <https://github.com/gjunge/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface HistoryAdapter {
bind(element: any, event: string, callback: () => void): void;
trigger(element: any, event: string): void;
onDomLoad(callback: () => void): void;
}
// Since History is defined in lib.d.ts as well
// the name for our interfaces was chosen to be Historyjs
// However at runtime you would need to do
// https://github.com/borisyankov/DefinitelyTyped/issues/277
// var Historyjs: Historyjs = <any>History;
interface Historyjs {
enabled: boolean;
pushState(data: any, title: string, url: string): void;
replaceState(data: any, title: string, url: string): void;
getState(): HistoryState;
getStateByIndex(index: number): HistoryState;
getCurrentIndex(): number;
getHash(): string;
Adapter: HistoryAdapter;
back(): void;
forward(): void;
go(x: Number): void;
log(...messages: any[]): void;
debug(...messages: any[]): void;
options: HistoryOptions;
}
interface HistoryState {
data?: any;
title?: string;
url: string;
}
interface HistoryOptions {
hashChangeInterval?: number;
safariPollInterval?: number;
doubleCheckInterval?: number;
disableSuid?: boolean;
storeInterval?: number;
busyDelay?: number;
debug?: boolean;
initialTitle?: string;
html4Mode?: boolean;
delayInit?: number;
}