New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

decouple

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

decouple

Decouple the DOM events from expensive functions.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

decouple

NPM version License Build status Coverage Status Dependency status devDependency status downloads

Decouple the DOM events from expensive functions.

Based on

Installation

$ npm install decouple

$ bower install decouple

$ spm install decouple

$ component install pazguille/decouple

Usage

function foo(event) {
  console.log('foo');

  // The function receive the scroll event as parameter.
  console.log(event);

  // The function context is the given node.
  console.log(this.scrollTop);
}

function bar() {
  console.log('bar');
}

decouple(document.querySelector('#box'), 'scroll', foo);

API

decouple(node, event, listener)

Decouple the DOM event from the listener on give node. Returns the listener handler.

  • node {HTMLElement} - A given HTMLElement.
  • event {String} - A given DOM event.
  • listener {Function} - A given listener to execute when the given event is fired.
decouple(window, 'scroll', fn);

With ❤ by

License

MIT license. Copyright © 2016.

Keywords

FAQs

Package last updated on 16 Feb 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc