An open API service indexing awesome lists of open source software.

https://github.com/oelin/ixy

A reversible event store.
https://github.com/oelin/ixy

events state-management time-travel

Last synced: 4 months ago
JSON representation

A reversible event store.

Awesome Lists containing this project

README

          

# ixy

A reversible event store.

This package aims to provide a bidirectional event-based state management system which supports timeline recomputation. This allows applications to change past actions while ensuring future state is affected in a predictable way. Useful for turn-based games or other applications where previous actions can be changed.

```js
const store = new Store(

(state, action) => {
if (action === 'increment') return state + 1
if (action === 'decrement') return state - 1
}
)
```

Perform actions.

```js
store.push('increment') // 1
store.push('increment') // 2
store.push('decrement') // 1
```

Move forwards or backwards in time.

```js
store.reverse() // 2
store.forward() // 1
```

Change prior actions and recompute the timeline deterministically.

```js
store.replace(0, 'decrement') // Set the initial action to `decrement` instead of `increment`.
// The new timeline is 0 -> 1 -> 0
```