Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function loadImage(file) {
img = new Image();
img.onload = e => drawImageToCanvas();
img.onerror = e => $log.warn('Failed to load image.');
fileReader = new FileReader();
fileReader.onload = e => img.src =;
fileReader.onerror = e => $log.warn('Failed to load file.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment