0.1.0 • Published 1 year ago

okahistory v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

0.0.9

2 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago