Skip to content

krawaller/callbag-from-delegated-event

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

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-for-each');

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

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published