Add typescript definition (#545)
This commit is contained in:
Vendored
+38
@@ -0,0 +1,38 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
|
||||||
|
import * as EventEmitter from 'events'
|
||||||
|
|
||||||
|
export = Choo
|
||||||
|
|
||||||
|
declare class Choo {
|
||||||
|
constructor (opts: Choo.IChoo)
|
||||||
|
use (callback: (state: Choo.IState, emitter: EventEmitter) => void): void
|
||||||
|
route (routeName: string, handler: (state: Choo.IState, emit: (name: string, ...args: any[]) => void) => 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
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IState {
|
||||||
|
events: {
|
||||||
|
[key: string]: string
|
||||||
|
}
|
||||||
|
params: {
|
||||||
|
[key: string]: string
|
||||||
|
}
|
||||||
|
query?: {
|
||||||
|
[key: string]: string
|
||||||
|
}
|
||||||
|
href: string
|
||||||
|
route: string
|
||||||
|
title: string
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
"xtend": "^4.0.1"
|
"xtend": "^4.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/node": "^8.0.20",
|
||||||
"browserify": "^14.3.0",
|
"browserify": "^14.3.0",
|
||||||
"bundle-collapser": "^1.2.1",
|
"bundle-collapser": "^1.2.1",
|
||||||
"dependency-check": "^2.8.0",
|
"dependency-check": "^2.8.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user