1.0.0-alpha.3 • Published 5 years ago

enso v1.0.0-alpha.3

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Enso

Minimalistic TypeScript-first state managment library for Node.js and browser.

It's just 120 bytes, but it can be used to manage state in complex applications.

TypeScript-first approach ensures complete type-safety.

Simplistic API allows to get the state managment out of the way and write code.

import createState from 'enso'

// Define state
type State = number

// Create typed operations on state
const { get, set, start } = createState<State>()

// Update state every second
setInterval(() => set(counter => counter + 1), 1000)

// Listen to state changes. The passed function is also trigger with the initial state .
const initialCounter = 0
start(initialCounter, (newCounter, prevCounter) =>
  console.log(newCounter, prevCounter)
)
//=> 0 undefined
//=> 1 0
//=> 2 1
//=> ...

// Get the current state
setTimeout(() => console.log(get()), 3000)
//=> 3

License

MIT © Sasha Koss

1.0.0-alpha.3

5 years ago

1.0.0-alpha.2

5 years ago

1.0.0-alpha.1

5 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.0

9 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago