Skip to content

feat: Support use blob to createComponent #20

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

Merged
merged 8 commits into from
Sep 26, 2022
Merged

Conversation

WaylonFtrack
Copy link
Contributor

No description provided.

@WaylonFtrack WaylonFtrack requested a review from a team as a code owner September 4, 2022 10:08
Copy link
Contributor

@jimmycallin jimmycallin left a comment

Choose a reason for hiding this comment

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

Hi @WaylonFtrack! Would you mind looking into getting the tests for file uploading to work (they are currently skipped), and add an additional test for blobs? Thanks!

@jimmycallin jimmycallin changed the title Support use blob to createComponent feat: Support use blob to createComponent Sep 22, 2022
@lucaas
Copy link
Contributor

lucaas commented Sep 23, 2022

Is the goal to add support for browsers not supporting the File constructor, or what is the motivation for the change?

@WaylonFtrack
Copy link
Contributor Author

I was trying to upload canvas image from HTMLCanvasElement.toBlob. Since file constructor is additional wrapper, and the changes to directly support Blob are minimal and compatible with File, I submitted this PR.

@@ -825,9 +829,13 @@ export class Session {
let headers;

const updateOnProgressCallback = (oEvent) => {
let progress = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

jsdom won't set request headers before request, cause onProgress never be called in test enviroment.

Copy link
Contributor

@jimmycallin jimmycallin left a comment

Choose a reason for hiding this comment

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

I'm happy with this, but would like @lucaas to approve as well! Good job with the tests as well!

@lucaas
Copy link
Contributor

lucaas commented Sep 26, 2022

I was trying to upload canvas image from HTMLCanvasElement.toBlob. Since file constructor is additional wrapper, and the changes to directly support Blob are minimal and compatible with File, I submitted this PR.

I see. In the review player, we also use canvas.toBlob, but duck-type it as a File by just setting blob.name. This is a cleaner solution, so happy to accept it.

@jimmycallin jimmycallin merged commit dc8cae4 into main Sep 26, 2022
@jimmycallin jimmycallin deleted the component-name branch September 26, 2022 15:11
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