Coder Social home page Coder Social logo

rescript-debounce's Introduction

rescript-debounce

version license build

This repo contains two packages:

See their READMEs for details.

ShakaCode

If you are looking for help with the development and optimization of your project, ShakaCode can help you to take the reliability and performance of your app to the next level.

If you are a developer interested in working on ReScript / TypeScript / Rust / Ruby on Rails projects, we're hiring!

Supporters

JetBrains ScoutAPM
BrowserStack Rails Autoscale Honeybadger

The following companies support our open source projects, and ShakaCode uses their products!

rescript-debounce's People

Contributors

alex35mil avatar alexfedoseev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rescript-debounce's Issues

Doesn't work in Cypress

Hi,
for some very strange reason the rescript-debounce doesn't work in Cypress (Chrome browser).

Wrong link on npm package?

Thanks for creating this, it makes it super easy to debounce in ReScript!

I just noticed that the npm package for rescript-debounce-react contains dead links to homepage and repo.

It links to https://github.com/shakacode/rescript-debounce-react#readme which I guess should be https://github.com/shakacode/rescript-debounce/tree/master/rescript-debounce-react?

`Debouncer.useDebounced` React hook

Should it be added in this package or a separate package? The issue with the former is that it would require React to be available in a project. And it wouldn't compile if it's used in a project that doesn't depend on React.

How to use?

Hi,

I'm trying to debounce a function call that filters an array of elements given an Input.
I want the filtering to be done after 0.5 seconds after the user stopped inserting input.

My function is :

let filterArray = (arrayToFilter, filterInput) =>
Belt.Array.keep(arrayToFilter, element => 
Js.String.includes(Js.String.toLowerCase(filterInput), Js.String.toLowerCase(element |> string_of_int)));

It works fine with no debouncing.

If I try :
let debouncedFilter = Debouncer.make(((array, input)) => filterArray(array, input));
I should be able to then use :
debouncedFilter((array, input));

But I get an error with unit :
This has type: array() But somewhere wanted: unit

In the source I see :
fn : 'a => unit

So can we only debounce functions wich return unit? How would I adapt my example to work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.