waitFor
Wait for a specific event type on this call, optionally filtered by a predicate function. This is a one-shot listener — it resolves on the first matching event and then removes itself.
Parameters
eventType
The event type string to wait for.
predicate
Optional filter function. If provided, the wait only resolves when the
predicate returns true for a received event.
timeout
Maximum milliseconds to wait. Throws an Error if exceeded. undefined
waits indefinitely.
Returns
Promise<RelayEvent> — The first event matching the type and optional predicate.