Skip to content

phanhuyanh/debounce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Debouncex

A process debouncer for Elixir

Docs

Debouncex

What is Debounce?

Debounce will call function with delay timeout, but if function is called multiple time with delay period, the time is reset and delay is counted again. Like debounce in Javascript but for Elixir.

Example

iex> defmodule Hello do
   def hello do
    :world
  end
end

iex> {:ok, pid} = Debouncex.start_link({
  &Hello.hello/0,
  [],
  1000
})

iex> Debouncex.call(pid) # Scheduler call after 1s
iex> :timer.sleep(100)
iex> Debouncex.call(pid) # Scheduler call after 1s
iex> :world

Installation

If available in Hex, the package can be installed by adding debouncex to your list of dependencies in mix.exs:

def deps do
  [
    {:debouncex, "~> 0.1.0"}
  ]
end

About

A process debouncer for Elixir

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages