Giter Club home page Giter Club logo

time-traveller's Introduction

TimeTraveller

TimeTraveller is a state management library that provides undo, redo, delete, and jump-to-state functionality. It's designed for both plain JavaScript and React applications. The library uses fast-json-patch to store state differences and allows state tagging for filtering purposes.

Design Architecture

The Time Traveller library is designed to be efficient and easy to use. It consists of the following main components:

  1. TimeTraveller: A utility module responsible for managing state history with undo, redo, jumpTo, delete, and filterStates functionality.

  2. TimeTravellerProvider: A React context provider that wraps your application, providing access to the TimeTraveller utility and additional functions like subscribe, unsubscribe, notify, link, and unlink. This provider optimizes performance by only re-rendering components affected by state changes using a pub-sub pattern.

  3. useTimeTraveller: A custom React hook that provides access to the TimeTraveller context.

  4. useTimeTravellerState: A custom React hook to manage local component state with TimeTraveller.

  5. useTimeTravellerGlobalState: A custom React hook to manage global state with TimeTraveller, allowing you to link and sync local component state with global state.

The library uses a pub-sub pattern to notify only the linked components about state changes, so only the components affected by the state change will be re-rendered, improving the performance of your application.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Installation

Install the library using npm:

npm install time-traveller
``

time-traveller's People

Contributors

sanjay1909 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.