'use static';
'use strict';

export default function getStaticImageDataUrl(imageUrl) {
function getStaticImageDataUrl(imageUrl) {
	return new Promise((resolve, reject) => {
		let image = new Image();

		image.crossOrigin="anonymous"
		image.crossOrigin = "Anonymous";
		image.src = imageUrl;

		image.onload = () => {
			let canvas = document.createElement('canvas')
			let canvas = document.createElement('canvas');

			canvas.width = image.width;
			canvas.height = image.height;

			let context = canvas.getContext('2d')
			let context = canvas.getContext('2d');

			context.drawImage(image, 0, 0)
			context.drawImage(image, 0, 0);

			let staticImageUrl = canvas.toDataURL()
			let staticImageUrl = canvas.toDataURL();

			resolve(staticImageUrl)
			resolve(staticImageUrl);
		}

		img.onerror = reject;
	})
	
}

if (typeof module !== 'undefined' && typeof module.exports !== 'undefined')
	module.exports = getStaticImageDataUrl;
else
	window.getStaticImageDataUrl = getStaticImageDataUrl;

@@ -4,87 +4,15 @@
 e st
-atic';%0A'use strict';%0A%0Aexport default function getStaticImageDataUrl(imageUrl) %7B
+rict';%0A
 %0Afun
@@ -126,40 +126,8 @@
 );%0A%0A
-%09%09image.crossOrigin=%22anonymous%22%0A
 %09%09im
@@ -211,57 +211,8 @@
 %3E %7B%0A
-%09%09%09let canvas = document.createElement('canvas')%0A
 %09%09%09l
@@ -327,49 +327,8 @@
 t;%0A%0A
-%09%09%09let context = canvas.getContext('2d')%0A
 %09%09%09l
@@ -370,42 +370,8 @@
 );%0A%0A
-%09%09%09context.drawImage(image, 0, 0)%0A
 %09%09%09c
@@ -406,51 +406,8 @@
 );%0A%0A
-%09%09%09let staticImageUrl = canvas.toDataURL()%0A
 %09%09%09l
@@ -451,35 +451,8 @@
 );%0A%0A
-%09%09%09resolve(staticImageUrl)%0A
 %09%09%09r
@@ -484,17 +484,19 @@
 %09%7D%0A%0A%09%09im
-g
+age
 .onerror
@@ -498,22 +498,50 @@
 error = 
-reject
+(e) =%3E %7B%0A%09%09%09resolve(imageUrl);%0A%09%09%7D
 ;%0A%09%7D)%0A%09%0A

fix error handling