I have multiple different types of events that trigger a CPU-intensive task. If more than one of these different types of events triggers in any given “frame”, I’d like to skip it after the first time.
The logic would look something like:
const tick = Meteor.eventTickCount() // <----- What can I use? if (this?._lastUpdateTick === tick) return /* do CPU-intensive work */ this._lastUpdateTick = tick
I looked around a bit but didn’t see anything, and I’m not sure if Date.now() or Performance.now() are correct, or guaranteed to work in the future.
Any thoughts/suggestions? Thanks.