ParametricPress / 01-unraveling-the-jpeg

Source code for Unraveling the JPEG
https://parametric.press/issue-01/unraveling-the-jpeg/
MIT License
245 stars 21 forks source link

Support IE/Edge/Safari #3

Closed OmarShehata closed 5 years ago

OmarShehata commented 5 years ago

We use createImageBitmap to create a new image out of the edited bytes, and then render it. This is not supported on Edge/IE/Safari:

https://caniuse.com/#search=createImageBitmap

I think we can add support for those browsers with a little more work. There's probably a library out there to help/handle this.

OmarShehata commented 5 years ago

I believe this was fixed by the polyfill added by @mathisonian. It won't work in IE because Promise isn't defined though.

The article currently doesn't work in IE because something is calling Object.assign without a polyfill:

Object doesn't support property or method 'assign'

Just noting this but I don't think it's blocking release.

TRANKILLLO commented 5 years ago

IE doesn't support Object.assign()

Use polyfil

if (typeof Object.assign != 'function') {

Object.assign = function(target, varArgs) { // .length of function is 2 'use strict'; if (target == null) { // TypeError if undefined or null throw new TypeError('Cannot convert undefined or null to object'); }

var to = Object(target);

for (var index = 1; index < arguments.length; index++) {
  var nextSource = arguments[index];

  if (nextSource != null) { // Skip over if undefined or null
    for (var nextKey in nextSource) {
      // Avoid bugs when hasOwnProperty is shadowed
      if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
        to[nextKey] = nextSource[nextKey];
      }
    }
  }
}
return to;

}; } If you are using babel

npm install --save-dev babel-plugin-transform-object-assign using .babelrc

{ "plugins": ["transform-object-assign"] }

OmarShehata commented 5 years ago

Thanks for the tip @TRANKILLLO ! It would be awesome if you could open a pull request for this!

TRANKILLLO commented 5 years ago

ok @OmarShehata :) but a second point could be fixed !! Object doesn't support property or method 'includes ' ... too A react error handling behavior ?