https://github.com/blahah/choo-asyncify
make choo's events non-blocking ... :train: ...
https://github.com/blahah/choo-asyncify
Last synced: about 2 months ago
JSON representation
make choo's events non-blocking ... :train: ...
- Host: GitHub
- URL: https://github.com/blahah/choo-asyncify
- Owner: blahah
- License: mit
- Created: 2017-04-10T17:47:37.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-14T09:30:56.000Z (about 8 years ago)
- Last Synced: 2025-03-25T20:13:59.591Z (2 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 13
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
choo-asyncify
make choo events asychronous----
:steam_locomotive::train::train::train::train::train: (choo
) + :train: (choo-asyncify
)----
[choo](https://github.com/yoshuawuyts/choo) is a super lightweight, well engineered frontend framework.
`choo` v5 is event-based. Where previous versions would asynchronously send messages from views to effects, v5 uses [nanobus](https://github.com/yoshuawuyts/nanobus) to send [synchronous events](https://github.com/yoshuawuyts/nanobus#are-the-emitters-asynchronous).
Depending on how you structure your app, this might cause blocking of UI updates.`choo-asyncify` monkey-patches the `nanobus` instance passed around by `choo` so that every event is non-blocking.
Specifically, each `emit` call is wrapped in a `setImmediate`, or if `setImmediate` isn't available, in a `setTimeout(fn, 0)`.## install
```bash
npm install --save choo-asyncify
```## usage
Just pass `choo-asyncify` to `choo().use()`:
```js
var app = require('choo')()app.use(require('choo-asyncify'))
```