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

Use yetch and support AbortController #112

Merged
merged 1 commit into from
May 14, 2018
Merged

Conversation

tchak
Copy link
Collaborator

@tchak tchak commented May 13, 2018

This is an attempt at #111

@stefanpenner
Copy link
Collaborator

stefanpenner commented May 14, 2018

Just noting some stuff, just doing diligence.

yetch: 3,169 (gzipd)
whatwg-fetch: 2,904 (gzipd)

Size difference basically doesn't matter. Getting abort control well justifies that.


I skimmed the code for yetch it also appears good.


I pinged @jayphelps (one of the yetch maintainers) just to see if he had any thoughts/concerns for us.

self['Headers'] = fetch.Headers;
self['Request'] = fetch.Request;
self['Response'] = fetch.Response;
var AbortControllerPolyfill = FastBoot.require('abortcontroller-polyfill/dist/cjs-ponyfill');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need our Fastboot users to also additionally import/require the abortcontroller polyfil, or does this happen automagically? If so, can you briefly explain how?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like with browser implementation :

import fetch, { AbortController } from 'fetch';

I will add a paragraph to README to clarify

@stefanpenner
Copy link
Collaborator

cc @nlfurniss

@stefanpenner
Copy link
Collaborator

stefanpenner commented May 14, 2018

@tchak have you confirmed all the abort-controller stuff works correctly with node-fetch as well? I don't actually see support for signal within node-fetch's code-base.

@jayphelps
Copy link
Member

@stefanpenner @tchak yep node-fetch does not appear to support abort signals yet node-fetch/node-fetch#437

@stefanpenner
Copy link
Collaborator

@tchak I'm unsure if we should go down this path, until node-fetch supports signals. Thoughts?

@tchak
Copy link
Collaborator Author

tchak commented May 14, 2018

@stefanpenner
Copy link
Collaborator

@tchak ah, thank-you. This lgtm.

@stefanpenner stefanpenner merged commit 3ab7ddd into ember-cli:master May 14, 2018
@stefanpenner
Copy link
Collaborator

released as v4.0.1 🎉


var fetch = normalizeFileName(find(expandedFetchPath));
var expandedFetchPath = expand(fetchPath, 'dist/yetch-polyfill.js');
var expandedAbortcontrollerPath = expand(abortcontrollerPath, 'abortcontroller-polyfill-only.js');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abortcontroller-polyfill-only.js doesn't have abortableFetch which means we can't do
fetch(Request("http://api.github.com", {signal}))

The test in this PR only tested controller is polyfilled but not abortable fetch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants