-
Notifications
You must be signed in to change notification settings - Fork 16
Description
I have no idea how the API would look for this (might be... complicated) but I think some considerations should be made for how abort could be integrated.
https://developer.mozilla.org/en-US/docs/Web/API/AbortController
If I'm using this client to fire off a debounced JSON-RPC search query, I'd want to be able to abort the previous query every time a new request is being fired, to avoid race conditions.
I think possibly the simplest way to support it would be to change ClientInterface.ts interface Arguments to include timeout and signal as optional properties (timeout to optionally replace the existing second arg of rpc.request() moving it into the first arg's object, can do like requestObject.timeout ?? timeout for backwards compat) and pass the signal down into the transport's sendData.