C#C
C#3y ago
CrosRoad95

❔ Batching actions

I have a technical question, let's say i have method that increment counter. The idea is that i would like to call this function multiple times and somehow detect what was the last change
inc();inc();inc(); - emit event notifying that counter = 3

right now i solved it by adding await Task.Delay that wait for few miliseconds, if new change arrive - cancel previous delay and begin delay again. if no new state change arrive - dispatch it
anyone have a smarter solution?
Was this page helpful?