I would simply like to return two different values based on event handlers firing or not, the types are load and error.
function image(url) {
    var asset = new Image();
    asset.addEventListener("load", function() {
        // return the image here
    }, false);
    asset.addEventListener("error", function() {
        // return false
    }, false);
    asset.src = url;
};
I know I can't return from inside the event listener but how can I make it so that if there was an error image will return false, otherwise the image?
Example usage;
var img = image("BAD URL"); // false
var img2 = image("GOOD URL"); // Image object
