Home

Awesome

deku-event

NPM version build status Downloads

Turn deku components into event emitters. Doesn't work as advertised yet, relies on segmentio/deku#51 to be resolved first.

Installation

$ npm install deku-event

Usage

const event = require('deku-event')
const deku = require('deku')

const component = deku.component
const dom = deku.dom

var 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.

const event = require('deku-event')
const deku = require('deku')

const component = event(deku.component)

component().use(event.plugin())

Attach a plugin to the component.

const event = require('deku-event')
const deku = require('deku')

const component = event(deku.component)
const dom = deku.dom

var button = component()
button.use(event.plugin())

License

MIT