GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Alternative AbortController support (#54) by prk3 · Pull Request #137 · developit/unfetch

Conversation

@prk3

@prk3 prk3 commented Mar 26, 2020

Copy link
Copy Markdown

Resolves #54.

Alternative solution to #68.
My implementation differs in the following ways:

  • fetch does not override signal's abort handler (one controller can cancel many actions)
  • abort results in rejection with DOMExpection and proper error message.

I polyfilled AbortController and AbortSignal in tests, because they do not exist in node env.

To consider:

  • will addEventListener prevent GC from clearing unused fetch scopes?

Build:

Build "unfetch" to dist:
        556 B: unfetch.js.gz
        461 B: unfetch.js.br
        558 B: unfetch.mjs.gz
        464 B: unfetch.mjs.br
        629 B: unfetch.umd.js.gz
        525 B: unfetch.umd.js.br
Build "unfetch" to polyfill:
        559 B: index.js.gz
        466 B: index.js.br

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sayjeyhi, WesSouza, developit, and niksy reacted with thumbs up emoji
All reactions
  • 👍 4 reactions
kukulski.przemyslaw@gmail.com
abort controller support + test
c39fda7
@prk3 prk3 mentioned this pull request Mar 26, 2020
Add support for AbortController (#54) #68
Open
@niksy

niksy commented Jun 16, 2020

Copy link
Copy Markdown

Any movement on this? What can we do to merge this PR?

One thing that is missing here is check if signal is already aborted so unfetch can reject early, and throwing DOMException won’t work in IE11, so alternative code could be:

try {
	abortError = new DOMException('Aborted', 'AbortError');
} catch (err) {
	abortError = new Error('Aborted');
	abortError.name = 'AbortError';
}
sayjeyhi reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@developit
Merge branch 'master' into master
3d6bcd1
@eugeneilyin eugeneilyin mentioned this pull request Mar 25, 2021
The second alternative to AbortController support (#54, #68, #137) #148
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

add support for aborting via AbortController

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@prk3 @niksy @developit
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.