Skip to content

Commit

Permalink
support typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
malash committed Oct 10, 2017
1 parent 8b9ce90 commit 7b855d0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
type Path = string | string[];

type Message = 'get' | 'set';

export declare class State {
get(path?: Path): any
set(value: any): any
set(path: Path, value: any): any
cursor(path: Path): State
on(message: Message, callback: (data: any) => void): void
addEventListener(message: Message, callback: (data: any) => void): void
off(message: Message, callback: (data: any) => void): void
removeEventListener(message: Message, callback: (data: any) => void): void
snapshot(): void
canUndo(): boolean
undo(): void
canRedo(): boolean
redo(): void
push(...values: any[]): void
pop(): void
unshift(...values: any[]): void
shift(): void
fill(value: any): void
reverse(): void
splice(...values: any[]): void
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "dist/noflux-state.cjs.js",
"module": "dist/noflux-state.es.js",
"unpkg": "dist/noflux-state.umd.js",
"types": "index.d.ts",
"scripts": {
"prepublish": "npm run build",
"lint": "eslint src/ test/ benchmark/",
Expand Down

0 comments on commit 7b855d0

Please sign in to comment.