-
Notifications
You must be signed in to change notification settings - Fork 58
Closed
Description
Sometimes you will want to limit triggers to a specific frequency. Therefore I would like to suggest a decorator that provides this functionality.
It would be similar to the existing @time_active decorator, only it would check the time elapsed since the last time a task was called. If that time exceeds a provided threshold, the task is called. Otherwise it is skipped.
Something like this:
@state_trigger('some condition')
@debounce(millis=300)
def some_task():
pass
Meaning that the task will only be exceuted if the last execution was more than 300ms ago.
I tried implementing this myself, only to find out that pyscript doesn't support decorators.
Metadata
Metadata
Assignees
Labels
No labels