2.0.0 • Published 6 years ago

callbag-from-delegated-event v2.0.0

Weekly downloads
64
License
MIT
Repository
github
Last release
6 years ago

callbag-from-delegated-event

Create a callbag listenable source from events on a DOM node. The events are filtered to those where the target element matches the given selector, or is a child of an element that matches it.

npm install callbag-from-delegated-event

signature

(root: DOMelement, selector: string, eventName: string) => source

example

Create a listenable source of click events on .pawn elements in a surrounding game board.

const fromEvent = require('callbag-from-delegated-event');
const forEach = require('callbag-forEach');

const pawnClicks = fromEvent(gameBoard, '.pawn', 'click');

forEach(x => console.log(x))(pawnClicks); // MouseEvent ...
                                          // MouseEvent ...
2.0.0

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago