Socket
Book a DemoInstallSign in
Socket

eslint-plugin-delegated-events

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-delegated-events

Disallow delegating high-frequency events.

0.1.0
Source
npmnpm
Version published
Weekly downloads
286
-65.5%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-delegated-events

Disallow delegating high-frequency events.

The delegated-events library registers all event listeners on document, using selectors to determine an observer's interest in each event.

on('click', '.js-button', function(event) {
  console.log('clicked', this)
})

This is appropriate for most events, like click and change, but events fired at a high rate need to be directly bound with element.addEventListener to avoid performance problems.

This lint rule disallows delegated event listeners on the following events:

  • input
  • keydown
  • keypress
  • keyup
  • mouseout
  • mouseover
  • mousemove
  • scroll

Installation

You'll first need to install ESLint:

$ npm install eslint --save-dev

Next, install eslint-plugin-delegated-events:

$ npm install eslint-plugin-delegated-events --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-delegated-events globally.

Usage

Add delegated-events to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": [
    "delegated-events"
  ],
  "rules": {
    "delegated-events/no-high-freq": 2
  }
}

Development

npm install
npm test

License

Distributed under the MIT license. See LICENSE for details.

Keywords

eslint

FAQs

Package last updated on 27 Mar 2016

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.