Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@solid-primitives/debounce

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-primitives/debounce

Primitive that creates a debounce function

latest
Source
npmnpm
Version
1.3.0
Version published
Weekly downloads
325
316.67%
Maintainers
3
Weekly downloads
 
Created
Source

Solid Primitives Debounce

@solid-primitives/debounce

lerna size size stage

Creates a helpful debounce function.

Installation

npm install @solid-primitives/debounce
# or
yarn add @solid-primitives/debounce

How to use it

const fn = createDebounce((message: string) => console.log(message), 250));
fn('Hello!');
fn.clear() // clears a timeout in progress

Definition

function createDebounce<Args extends any[]>(
  func: (...args: Args) => void,
  wait?: number
): DebouncedFunction<Args>;

interface DebouncedFunction<Args extends any[]> {
  (...args: Args): void;
  clear: () => void;
}

Demo

You may view a working example here: https://codesandbox.io/s/solid-primitives-debounce-ng9bs?file=/src/index.tsx

Changelog

Expand Changelog

1.0.0

Initial commit and publish of debounce primitive.

1.0.1

Improved types, minor clean-up and added tests.

1.0.2

Changed any to unknown type and applied patch from high1.

1.0.5

Adding CJS support to package.

1.0.8

Cleaned up documentation

1.1.0

Updated to Solid 1.3

1.1.2

Added missing automated clean-up.

1.2.0

Improved types, changed output format from [fn, clear] to fn & { clear }

Keywords

debounce

FAQs

Package last updated on 14 Apr 2022

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