Not sure if this is what you are looking for, but you can use clearAllEvents() within the onScannedRobot(..) function. This clears all remaining scan events.