Type improvements (#706)
* use nanobus for the emitter typings instead of `events`, which is a bit different * add typings for `cache` option
This commit is contained in:
Vendored
+9
-5
@@ -1,13 +1,11 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as EventEmitter from 'events'
|
||||
import Nanobus = require('nanobus')
|
||||
|
||||
export = Choo
|
||||
|
||||
declare class Choo {
|
||||
constructor (opts?: Choo.IChoo)
|
||||
use (callback: (state: Choo.IState, emitter: EventEmitter, app: this) => void): void
|
||||
route (routeName: string, handler: (state: Choo.IState, emit: (name: string, ...args: any[]) => void) => void): void
|
||||
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
|
||||
@@ -18,6 +16,12 @@ declare namespace Choo {
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user