Concepts

Leading-only throttle policy

Try the free JavaScript compiler

Application policy for accepting a call only if the required interval has elapsed since the previous accepted call. Assumes nondecreasing times.

Formal Syntax & Structure

javascript syntaxjavascript
now - lastAccepted >= interval

Working Example

Example Snippetjavascript
(async () => {let last=-Infinity;const accepted=[];for(const t of [0,20,100,150,200]){if(t-last>=100){accepted.push(t);last=t;}}console.log(JSON.stringify(accepted));})()
JavaScript Reference