It isn't generally possible to know that the end of the buffer has been reached, because these events can just keep coming. There are some options, though:
1. you could set a small delay on handling the event, and restart the counter on each new event. That way, your response is limited to ~50ms, but you will only trigger the handler when there haven't been any new events in that time.
2. use mouseup event, rather than position updates, and only fire when the mouse has finished moving (may not make sense for your use case, if you want to update while dragging)
-Min