Socket
Socket
Sign inDemoInstall

microbounce

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    microbounce

Smol debounce package


Version published
Weekly downloads
157
increased by241.3%
Maintainers
1
Install size
4.06 kB
Created
Weekly downloads
 

Readme

Source

microbounce stability

npm version build status downloads js-standard-style

Smol debounce package.

Usage

var Microbounce = reuqire('microbounce')
var html = require('bel')

var microbounce = Microbounce()
html`
  <input onkeydown=${onkeydown}>click me</button>
`
function onkeydown (e) {
  var value = e.target.value
  microbounce(function () {
    console.log('called at the start of a new frame', value)
  })
}

Why?

Because most debounce functions don't work well when doing DOM diffing. This package is specifically made to work well with DOM diffing.

API

microbounce = Microbounce([timeout])

Create a new instance. Timeout defaults to 256ms.

microbounce(callback)

Debounce a callback for the duration of the timeout. The last callback wins if called multiple times in a row.

License

MIT

Keywords

FAQs

Last updated on 01 Apr 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc