Skip to content

Instantly share code, notes, and snippets.

@motin
Created November 2, 2012 02:59
Show Gist options
  • Save motin/3998426 to your computer and use it in GitHub Desktop.
Save motin/3998426 to your computer and use it in GitHub Desktop.
var done = function(err, image) {
console.log('before undefined foo-function');
foo();
console.log('after undefined foo-function');
}
function readImage(src, done) {
var image = new Canvas.Image;
image.onerror = function(err){
done(err); // makes subsequent errors silently ignored, console.log('image.onerror:', err); instead reports error to console
};
image.onload = function() {
done(null, image);
};
image.src = src;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment