Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidchase/pull-dom-events
Simple pull-stream for DOM events
https://github.com/davidchase/pull-dom-events
dom dom-events events pull-stream
Last synced: 29 days ago
JSON representation
Simple pull-stream for DOM events
- Host: GitHub
- URL: https://github.com/davidchase/pull-dom-events
- Owner: davidchase
- License: mit
- Created: 2016-06-30T17:10:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-07T04:50:43.000Z (over 8 years ago)
- Last Synced: 2024-10-14T20:03:04.643Z (about 1 month ago)
- Topics: dom, dom-events, events, pull-stream
- Language: JavaScript
- Size: 13.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pull-dom-events
Simple [pull-stream](https://github.com/pull-stream/pull-stream) for DOM events![](https://nodei.co/npm/pull-dom-events.png)
![](https://img.shields.io/npm/v/pull-dom-events.svg?style=flat-square) ![](https://img.shields.io/npm/l/pull-dom-events.svg?style=flat-square)
### Install`npm install --save pull-dom-events`
### Usage
```js
const pull = require('pull-stream')
const {pullEvent, click} = require('pull-dom-events')
const {log, filter} = pullpull(
pullEvent('click', document),
filter(event => event.target.matches(...)),
log()
)// or shorthand method
pull(
click(document),
filter(event => event.target.matches(...)),
log()
)```
#### `pullEvent(eventType, element, capture?)`
`pullEvent` takes a `eventType` such `click, mouseover, keydown, etc` an element such as `document` and an optional `capture` boolean.
#### `eventType(element, capture?)`
`eventType` takes a element to bind to and an option `capture` booleanCurrently supporting the following event-types:
`click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseenter, mouseout, mouseleave, keydown, keypress, keyup, load, unload `
```js
const source = click(document)
```### Todo
- [ ] more tests
- [ ] more shorthand event types