Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Nov 21, 2018
1 parent d576d4b commit 5ac5b57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![npm version][npmimg]][npm] [![build status][travisimg]][travis] [![coverage][coverallsimg]][coveralls]
[![downloads][downloadsimg]][downloads] [![js-standard-style][standardimg]][standard]

A generic DOM event handler. Inspired by a @webreflection [article](https://medium.com/@WebReflection/dom-handleevent-a-cross-platform-standard-since-year-2000-5bf17287fd38).
A generic DOM event handler. Works great in the browser. Does't work great in the Node.js ecosystem.

## Installation
```console
Expand All @@ -12,7 +12,7 @@ $ npm install dom-event-handler
## Usage

```js
import DOMEventHandler from "dom-event-handler"
const DOMEventHandler = require("dom-event-handler")

class MyWSController extends SomeOtherClass {
constructor () {
Expand Down Expand Up @@ -89,6 +89,12 @@ Implements the [`eventListener.handleEvent`](https://developer.mozilla.org/en-US

A getter that returns all events found on the `ctx` the handler is bound to. The events returned from this getter are what get attached and detached in the above methods.

## See also

This module was inspired by a @webreflection [article](https://medium.com/@WebReflection/dom-handleevent-a-cross-platform-standard-since-year-2000-5bf17287fd38).

This is a slick API, but has poor support in the Node.js ecosystem due to poor support for the [EventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventListener) interface ([Node.js style events](https://nodejs.org/api/events.html) do not support [handleEvent](https://developer.mozilla.org/en-US/docs/Web/API/EventListener/handleEvent) or similar). For a similar API see [node-event-handler](https://github.com/bcomnes/node-event-handler), which lacks the bind free benefits of this approach, but can provide a stand-in api when writing universal Node.js code.

## License
[MIT](https://tldrlegal.com/license/mit-license)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
},
"homepage": "https://github.com/bcomnes/dom-event-handler#readme",
"keywords": [
"WebReflection",
"arrow function",
"bind",
"EventListener",
"dom event handler",
"event",
"event handler",
Expand Down

0 comments on commit 5ac5b57

Please sign in to comment.