jwillinghalpern / fm-gofer

An easy fetch-like promise library for FileMaker WebViewer apps and widgets.
ISC License
19 stars 2 forks source link

Support AbortController to cancel requests #35

Open jwillinghalpern opened 8 months ago

jwillinghalpern commented 8 months ago

It would be nice to be able to cancel a request made to filemaker, if for example a React useEffect hook initiates a request but the component is then unmounted. We could use the abort controller to tell FMGofer to stop waiting for a response and prevent it from logging the timeout error in the console. I.e. cancel the promise.

Reference article from Fabio: https://spencerfeng.medium.com/create-an-abortable-api-using-abortcontroller-and-abortsignal-d774bed40701