Implement toBlob function on ModelViewerElementBase#861
Merged
cdata merged 12 commits intogoogle:masterfrom Nov 5, 2019
maaslalani:blobs
Merged
Implement toBlob function on ModelViewerElementBase#861cdata merged 12 commits intogoogle:masterfrom maaslalani:blobs
cdata merged 12 commits intogoogle:masterfrom
maaslalani:blobs
Conversation
maaslalani
commented
Oct 31, 2019
cdata
suggested changes
Oct 31, 2019
Contributor
cdata
left a comment
There was a problem hiding this comment.
Great work, thanks for the contribution @maaslalani !
Mostly minor feedback.
added 6 commits
October 31, 2019 19:55
…Chrome Desktop and Firefox
…ther utility functions.
…lency between supported and unsupported browsers
maaslalani
commented
Nov 1, 2019
Contributor
|
Push build running now: https://travis-ci.org/GoogleWebComponents/model-viewer/jobs/606219986 |
cdata
reviewed
Nov 1, 2019
cdata
reviewed
Nov 1, 2019
cdata
suggested changes
Nov 4, 2019
Contributor
|
Thanks for the great work on this @maaslalani LGTM 💯 |
cdata
approved these changes
Nov 5, 2019
elalish
pushed a commit
to elalish/model-viewer
that referenced
this pull request
Feb 4, 2020
* Implement toBlob function on model-viewer-base * Update documentation to specify qualityArgument is only available on Chrome Desktop and Firefox * Prefer Url over URL casing * Add License, Descriptive comment, and adjusted style guide to match other utility functions. * Utility function dataUrlToBlob async * Use spy helper to emulate unsupported browser and add test for equivalency between supported and unsupported browsers * Add support for msToBlob for IE * Remove .only from test suite * Compare arrayBuffers * Try and catch errors because spy toBlob will throw on edge * Skip test on IE11 and add comment on using Response * Remove https?: from objectUrlMatcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reference Issue
Fixes #858
Adds
toBlobto theModelViewerElementBase.https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob
General Approach
The general approach was to delegate the
toBlobon the model-viewer to the canvas. Instead of using callbacks likeHTMLCanvasElementdoes withtoBlob, I used promises so that it is possible to useasync/awaitsyntax. We can change this back if needed.