demos/Collage/fabric.js
function loadImage(url, callback, context) {
    if (url) {
      var img = new Image();
      /** @ignore */
      img.onload = function () {
        callback && callback.call(context, img);
        img = img.onload = null;
      };
      img.src = url;
    }
    else {
      callback && callback.call(context, url);
    }
  }
function loadImage(url, callback, context) {
    if (url) {
      var img = new Image();
      /** @ignore */
      img.onload = function () {
        callback && callback.call(context, img);
        img = img.onload = null;
      };
      img.src = url;
    }
    else {
      callback && callback.call(context, url);
    }
  }
function loadImage ( url , callback , context ) { if ( url ) { var img = new Image ( ) ; /** @ignore */ img . onload = function ( ) { callback && callback . call ( context , img ) ; img = img . onload = null ; } ; img . src = url ; } else { callback && callback . call ( context , url ) ; } }
Loads image element from given url and passes it to a callback
@method loadImage
@memberOf fabric.util
@param {String} url URL representing an image
@param {Function} callback Callback; invoked with loaded image
@param {Any} context optional Context to invoke callback in
Loads image element from given url and passes it to a callback