Awesome
<img alt="erre.js" src="https://cdn.rawgit.com/GianlucaGuarini/erre/main/erre-logo.svg" width="50%"/>erre.fromDOM
erre erre plugin to stream DOM events
Installation
npm i erre.fromdom -S
Usage
import fromDOM from 'erre.fromdom'
import erre from 'erre'
erre.install('fromDOM', fromDOM)
const resizes = erre.fromDOM(window, 'resize orientationchange', { passive: true })
const clicks = erre.fromDOM(document.body, 'click')
clicks.on.value(e => console.log(e))
resizes.on.value(e => console.log(e))
API
fromDOM
Create an erre stream from DOM events
Parameters
els
(HTMLElement | NodeList | Array) DOM node/s where the listeners will be boundeventsList
String list of events we want to stream space separatedoptions
Object event options (capture, once and passive)
Returns Generator erre stream generator