🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

addeventlistener

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

addeventlistener

`addEventListener` that takes options as an object and returns a function to remove the listener.

2.0.0
latest
Source
npm
Version published
Weekly downloads
8
700%
Maintainers
1
Weekly downloads
 
Created
Source

addeventlistener

addEventListener that takes options as an object and returns a function to remove the listener.

install

$ npm install addeventlistener

api

addEventListener(element, eventName, listener, options)

import addEventListener from 'addeventlistener'

const removeEventListener = addEventListener(
  document.body,
  'touchmove',
  e => {},
  { passive: false }
)

once(element, eventName, listener, options)

Listen for the event and stop listening after it has occurred once. You can still use the returned function to stop listening if you want to stop listening before the event has occurred once.

import { once } from 'addeventlistener'

const removeEventListener = once(window, 'click', console.log)

CommonJS

const { default: addEventListener, once } = require('addeventlistener')

Keywords

addEventListener

FAQs

Package last updated on 25 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts