https://github.com/zzarcon/xtore
General purpose lib to subscribe and handle state
https://github.com/zzarcon/xtore
rx rxjs state store subscribe subscription unsubscribe
Last synced: 3 months ago
JSON representation
General purpose lib to subscribe and handle state
- Host: GitHub
- URL: https://github.com/zzarcon/xtore
- Owner: zzarcon
- License: mit
- Created: 2018-03-23T07:27:55.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-04T14:13:55.000Z (about 7 years ago)
- Last Synced: 2025-02-24T13:39:18.164Z (4 months ago)
- Topics: rx, rxjs, state, store, subscribe, subscription, unsubscribe
- Language: TypeScript
- Homepage: https://zzarcon.github.io/xtore
- Size: 583 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xtore [](https://travis-ci.org/zzarcon/xtore)
> General purpose lib to subscribe and handle state
Xtore provides a generic way of notifying state changes, it's framework agnostic and easy to use in existing apps.
You can think about it like a convinient event emitter or a extremelly simple RXJS.
# Install```
$ yarn add xtore
```# Usage
#### Basic
```javascript
import Xtore from 'xtore';const xtore = new Xtore();
xtore.subscribe('some-unique-id', {
next(state) {
console.log(state);
}
});xtore.update('some-unique-id', {name: 'hector'});
// LOG: {name: 'hector'}
xtore.update('some-unique-id', {lastName: 'zarco'});
// LOG: {name: 'hector', lastName: 'zarco'}
xtore.update('some-unique-id', {name: 'leon'});
// LOG: {name: 'leon', lastName: 'zarco'}
xtore.update('other-id', {name: 'zzarcon'});
// Nothing will be logged 😉
```# Api
# Plugins
* React wrapper: https://github.com/zzarcon/react-xtore