Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abort requests #7

Closed
elbywan opened this issue Oct 6, 2017 · 0 comments
Closed

Abort requests #7

elbywan opened this issue Oct 6, 2017 · 0 comments
Assignees
Milestone

Comments

@elbywan
Copy link
Owner

elbywan commented Oct 6, 2017

Use AbortController to add timeout and abort features.

Something like :

let w = wretch("...")
  .signal("...") // optional - ability to use a custom AbortSignal to abort multiple requests
  .get() 
     // before the fetch() call, the signal should be injected by wretch
     // if no signal was added, wretch creates an AbortController for the request
  .setTimeout(number /* aborts after N milliseconds */)
  .onAbort(AbortError => /* new catcher for aborted requests */)

let [ c, w ] = w.controller() /* ugly :( but seems like there is no better way of doing things */
 
w.res(r => /* should never be called ... */)
c.abort()
@elbywan elbywan added this to the 1.0.0 milestone Oct 6, 2017
@elbywan elbywan self-assigned this Oct 6, 2017
elbywan added a commit that referenced this issue Oct 7, 2017
elbywan added a commit that referenced this issue Oct 7, 2017
@elbywan elbywan closed this as completed in c5888fe Oct 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant