forked from choojs/choo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
43 lines (37 loc) · 939 Bytes
/
index.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
import Nanobus = require('nanobus')
export = Choo
declare class Choo {
constructor (opts?: Choo.IChoo)
use (callback: (state: Choo.IState, emitter: Nanobus, app: this) => void): void
route (routeName: string, handler: (state: Choo.IState, emit: Nanobus['emit']) => void): void
mount (selector: string): void
start (): HTMLElement
toString (location: string, state?: Choo.IState): string
}
declare namespace Choo {
export interface IChoo {
history?: boolean
href?: boolean
hash?: boolean
cache?: number | ICache
}
export interface ICache {
get(id: string | number): undefined | null | any
set(id: string | number, element: any): void
}
export interface IState {
events: {
[key: string]: string
}
params: {
[key: string]: string
}
query?: {
[key: string]: string
}
href: string
route: string
title: string
[key: string]: any
}
}