Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yoshuawuyts/deku-event
Turn deku components into eventEmitters
https://github.com/yoshuawuyts/deku-event
Last synced: 12 days ago
JSON representation
Turn deku components into eventEmitters
- Host: GitHub
- URL: https://github.com/yoshuawuyts/deku-event
- Owner: yoshuawuyts
- License: mit
- Created: 2015-03-08T13:15:00.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-08T16:40:44.000Z (almost 10 years ago)
- Last Synced: 2024-12-06T08:46:53.685Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 125 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-deku - deku-event - Turn Deku components into eventEmitters (Miscellaneous)
README
# deku-event
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Downloads][downloads-image]][downloads-url]Turn deku components into event emitters. Doesn't work as advertised yet,
relies on [segmentio/deku#51](https://github.com/segmentio/deku/issues/51) to
be resolved first.## Installation
```bash
$ npm install deku-event
```## Usage
```js
const event = require('deku-event')
const deku = require('deku')const component = deku.component
const dom = deku.domvar button = component()
button.use(event.plugin())button.on('render', function (props, state) {
return dom('button')
})button.render(document.body, {foo: 'bar'})
```## API
#### event(deku.component)
Wrap `deku.component` so all created components use `deku-event` by default.
```js
const event = require('deku-event')
const deku = require('deku')const component = event(deku.component)
```#### component().use(event.plugin())
Attach a plugin to the component.
```js
const event = require('deku-event')
const deku = require('deku')const component = event(deku.component)
const dom = deku.domvar button = component()
button.use(event.plugin())
```
## License
[MIT](https://tldrlegal.com/license/mit-license)[npm-image]: https://img.shields.io/npm/v/deku-event.svg?style=flat-square
[npm-url]: https://npmjs.org/package/deku-event
[travis-image]: https://img.shields.io/travis/yoshuawuyts/deku-event.svg?style=flat-square
[travis-url]: https://travis-ci.org/yoshuawuyts/deku-event
[downloads-image]: http://img.shields.io/npm/dm/deku-event.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/deku-event