9.0.0 • Published 4 months ago

@greenlabs/rescript-use-debounce v9.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

rescript-use-debounce

Binding of use-debounce package

Install

npm i @greenlabs/rescript-use-debounce
or
yarn add @greenlabs/rescript-use-debounce
"bs-dependencies": [
  "@greenlabs/rescript-use-debounce"
]

Usage

let test = () => {
  let (debouncedCallback, debouncedCallbackMethods) = useDebouncedCallback(e => {
    e->ReactEvent.Synthetic.preventDefault
  }, 500, ~options={maxWait: 500})

  (debouncedCallback, debouncedCallbackMethods.isPending())
}

Note

flush()'s type signature is unit => ReturnType<callback>, but couldn't find a way to achieve it in ReScript so left the return type as unit.

9.0.0

4 months ago

0.0.1

1 year ago