Skip to content

est une implémentation d'un gestionnaire d'historique permettant de gérer des états de manière à pouvoir effectuer des opérations d'annulation (undo) et de répétition (redo) sur ces états

ramsesndame237/history-state-manager

Repository files navigation

history-state-manager

Efficient management of state history with structure sharing, providing a non-intrusive approach to tracking state changes in web and software applications.This solution aims to minimize data duplication by sharing common parts between successive state thereby improving performance and reducing memory consumption

Installation

Install via NPM :

    npm i history-state-manager

Basic usage:

import { History } from 'history-state-manager'

const state = { a: 1, b: 2 }

const history = new History()
history.pushSync(state) // the terser `history.push` API is async

state.a = 2 // mutation!
history.pushSync(state)

history.get() // { a: 2, b: 2 }
history.undo().get() // { a: 1, b: 2 }
history.redo().get() // { a: 2, b: 2 }

About

est une implémentation d'un gestionnaire d'historique permettant de gérer des états de manière à pouvoir effectuer des opérations d'annulation (undo) et de répétition (redo) sur ces états

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published