Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

throttleit

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

throttleit

Throttle a function to limit its execution rate

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.8M
increased by0.48%
Maintainers
0
Weekly downloads
 
Created

What is throttleit?

The throttleit package is a utility that allows you to throttle a function, meaning it limits the rate at which a function can fire. This is particularly useful for handling repetitive events that you want to control, such as window resizing, scrolling, or keypresses in a performant way.

What are throttleit's main functionalities?

Throttling function calls

This code sample demonstrates how to use throttleit to throttle a window resize event handler. The onResize function will not be called more than once every 200 milliseconds, no matter how often the resize event fires.

const throttle = require('throttleit');

function onResize(event) {
  console.log('Window resized.');
}

window.addEventListener('resize', throttle(onResize, 200));

Other packages similar to throttleit

Keywords

FAQs

Package last updated on 21 Jun 2024

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