https://github.com/pakastin/redom-state
RE:DOM state handling example
https://github.com/pakastin/redom-state
javascript redom
Last synced: over 1 year ago
JSON representation
RE:DOM state handling example
- Host: GitHub
- URL: https://github.com/pakastin/redom-state
- Owner: pakastin
- Created: 2016-12-12T21:45:24.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-30T11:07:08.000Z (about 9 years ago)
- Last Synced: 2025-02-28T14:49:57.986Z (over 1 year ago)
- Topics: javascript, redom
- Language: JavaScript
- Homepage: https://pakastin.github.io/redom-state/
- Size: 49.8 KB
- Stars: 19
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# redom-state
[RE:DOM](https://redom.js.org) state handling example
## Demo
https://pakastin.github.io/redom-state/
## How it works?
The whole [redux](https://github.com/reactjs/redux)-like [state handling code is only 447 bytes](https://github.com/pakastin/redom-state/blob/master/js/utils/dispatch.js) uncompressed. Redux is [30.1 KB](https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.js) for comparison.
It uses native HTML events to dispatch actions upstream and RE:DOM component updates to update views downstream. That's it :)
Here's the action definitions:
https://github.com/pakastin/redom-state/blob/master/js/actions.js
This is what binds everything together:
https://github.com/pakastin/redom-state/blob/master/js/utils/api.js
## Benefits
- Fast
- Small
- Asynchronous, but immediate
- Flexible (stopPropagation etc)
## Future
I will release this as a separate library or some parts included in RE:DOM. For now it's just an experiment.
## Run
```
npm start
```
Then navigate to [http://localhost:8080/](http://localhost:8080/)
## Dev mode
```
npm run dev
```