TTTaevas / osu-api-v2-js

Package to easily access the new api of osu!
https://osu-v2.taevas.xyz
The Unlicense
6 stars 0 forks source link

Add `API.withSettings()` and `ChildAPI` to allow users giving `AbortSignal`s #34

Closed TTTaevas closed 6 months ago

TTTaevas commented 6 months ago

Closes #33

The main goal of this PR is to allow users of this package to cancel any ongoing request through the usage of AbortControllers and ̀AbortSignals However, it also allows them to have more influence on any request, by changing its headers and other things (with the exception of body)

@baileyherbert This PR does things pretty much the way you came up with, so maybe you'd like to check if anything looks odd here? If you do, there's no need to look through misc.ts, its only real addition is the code for merging signals together, which remains completely unchanged

baileyherbert commented 6 months ago

Hi @TTTaevas! It looks good to me. I played around with various scenarios, and it all worked as expected. 😁

TTTaevas commented 6 months ago

Awesome, thank you very much for your help! :D