event-listener-with-options

1.1.0 • Public • Published

event-listener-with-options

GitHub license npm version CircleCI Status Greenkeeper badge

This module exports two functions:

  • addEventListener(target, type, handler, options)
  • removeEventListener(target, type, handler, options)

These work like target.addEventListener(type, handler, options), except that options is allowed to be an object even in browsers which don't yet support that. In that case, only the options object's capture property is respected.

See https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md for more information on the options parameter.

This module also includes an optional polyfill. Use the following to override the addEventListener and removeEventListener methods on all EventTargets with replacements that support an options object if necessary:

require('add-event-listener-with-options/js/polyfill');

Types

Both TypeScript and Flow type definitions for this module are included! The type definitions won't require any configuration to use.

Dependencies (0)

    Dev Dependencies (14)

    Package Sidebar

    Install

    npm i event-listener-with-options

    Weekly Downloads

    2,250

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    18.1 kB

    Total Files

    14

    Last publish

    Collaborators

    • macil