deko-debounce

1.0.0 • Public • Published

deko-debounce build status

debounce decorator for deko.

const deko = require('deko')
const debounce = require('deko-debounce')

class WorldClass {
  constructor() {
    deko(this)
  }

  static $$ontypedDebounced() {
     return [ debounce({ wait: 50 }) ]
  } ontypedDebounced(e) {
    // do stuff here
  }
}

const worldClass = new WorldClass()

for (var i = 0; i < 5; i++) {
  worldClass.ontypedDebounced()
}
// ontypedDebounced only executes one time after 50ms elapsed

Installation

npm install deko-debounce

API

debounce

Creates a debounce decorator to be used with deko

Parameters

  • $0 Object config
    • $0.wait Number number of milliseconds for which to postpone executions
    • $0.immediate Boolean if true causes debounce to trigger the function on the leading edge instead of the trailing edge of the wait interval

Returns Object debounceDecorator to be used with deko

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i deko-debounce

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

4.46 kB

Total Files

4

Last publish

Collaborators

  • thlorenz