title: Callback function executes too late
body: <p>I am using fabric.js to render images on canvas. Trying to render 3 images with different properties (like localization, source, etc.).</p>
  
  <pre><code>for (i = 0; i &lt; 3; i++) {
    // read data from XML
    // ... read: imageWidth, imageHeight, etc.
  
    var imageDefaults = {
      width: imageWidth,
      height: imageHeight,
      left: imageX,
      top: canvas.height - imageY,
      angle: imageRotation
    };
  
    console.log('outside callback fun');
  
    fabric.Image.fromURL(imagePath, function (image) {
      image.set(imageDefaults).setCoords();                                    
      canvas.add(image);
      console.log('inside callback fun');                 
    });
  }
  </code></pre>
  
  <p>The output console log is:</p>
  
  <pre><code>outside callback fun
  outside callback fun
  outside callback fun
  inside callback fun
  inside callback fun
  inside callback fun
  </code></pre>
  
  <p>As a result, I receive 3 images with the same properties (for i == 2).</p>
  
  <p>How to ensure loop continuation only if image is rendered? I tried to set while loop after rendering image, but this loop is running infinitely.</p>