Adds event listener.
Events
Event name
Event handler
Protected
fireFire event
Type of event
Arguments for event
Remove event listener
Make a request and don't wait for the outcome.
Response has been received
Response
True if response matched a request
Matches responses with requests, expiring requests if they do not get a response in a timely manner.
Basic usage:
It's also possible to wait for specific replies:
It relies on creating an id of a request/response for them to be matched up. Use the
key
option if the function can generate a key from either request or response. Or alternatively set bothkeyRequest
andkeyResponse
for two functions that can generate a key for request and response respectively.The easy case is if req & resp both have the same field:
A more complicated case:
By default, error will be thrown if a response is received that doesn't match up to any request.