0.1.0 • Published 2 years ago

okahistory v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Main License: MIT

okahistory

This is a convenient tool for the features of undo-redo operations.

usage

yarn add okahistory
import type { Reducer } from 'okahistory'
import { useHistory } from 'okahistory'

const state = { count: 0 }
const history = useHistory()

// define your reducers
const reducerA: Reducer<number, number> = {
  redo(after) {
    const before = state.count
    state.count = after
    return before
  },
  undo(before) {
    state.count = before
  },
}
const { dispatch, createAction } = history.defineReducers({ ACTION_A: reducerA })

// dispatch an action
dispatch(createAction('ACTION_A', 1))

// undo & redo
history.undo()
history.redo()

commnad

# install dependencies
$ yarn install

# lint
$ yarn lint

# test
$ yarn test [--watch]

# build
$ yarn build

publish

Create new release on Github.

0.1.0

2 years ago

0.0.9

3 years ago

0.0.8

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago