Skip to content

Commit

Permalink
feat: ts type
Browse files Browse the repository at this point in the history
add typescript type to methods
  • Loading branch information
namelessman committed Aug 9, 2019
1 parent ce62b78 commit 1df9dbd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/simplestateshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: namelessman
* @Date: 2019-08-01 00:12:21
* @LastEditors: namelessman
* @LastEditTime: 2019-08-01 13:21:12
* @LastEditTime: 2019-08-09 09:30:28
*/
class SimpleStateShot {
constructor(private _maxLength?: number) {
Expand All @@ -21,7 +21,7 @@ class SimpleStateShot {
return null
}

push(state: any) {
push(state: any): SimpleStateShot {
// don't push if equal with current state
if (JSON.stringify(state) === JSON.stringify(this.get())) {
return this
Expand Down Expand Up @@ -53,23 +53,23 @@ class SimpleStateShot {
return true
}

undo() {
undo(): SimpleStateShot {
if (this.hasUndo) {
this._index--
}

return this
}

redo() {
redo(): SimpleStateShot {
if (this.hasRedo) {
this._index++
}

return this
}

reset() {
reset(): SimpleStateShot {
this._index = -1
this._states = []

Expand Down

0 comments on commit 1df9dbd

Please sign in to comment.