Debounce#

class ignis.utils.Utils.DebounceTask(ms: int, target: Callable) None#

Delays function calls until a specified time elapses after the most recent call.

Hint

See the decorator for this class debounce().

Parameters:
  • ms (int) -- The delay time in milliseconds.

  • target (Callable) -- The function to invoke after the delay.

ignis.utils.Utils.debounce(ms: int)#

A decorator to delay function execution until a set time has passed since the last call.

This is a convenient wrapper for the DebounceTask class.

Parameters:

ms (int) -- The delay time in milliseconds.

Example usage:

from ignis.utils import Utils

@Utils.debounce(500) # delay for 500 ms (0.5 s)
def some_func(x) -> None:
    print("called!")

some_func(1)
some_func(2)  # only this call will execute