title: CreateJS using ES6 modules
body: <p>I'm using createJS - <a href="http://www.createjs.com/preloadjs" rel="nofollow">preloadJS</a> and ES6 along with Babel and webpack.</p>
  
  <pre><code>const files = [{ src: 'characterSprite.png', id: 'characterSprite' }];
  
  const Loader = new createjs.LoadQueue(false);
  Loader.loadManifest(files, true, 'img/');
  
  export default Loader;
  </code></pre>
  
  <p>What I want to achieve is in <em>preload.js</em> to load all the images, and in other files (eg. <em>hero.js</em>) to do something like:</p>
  
  <pre><code>import Loader from './loader';
  Loader.getResult('characterSprite');
  </code></pre>
  
  <p>The thing is that when I call <code>.getResult()</code> on loader, the loader has not finished preloading so it returns <code>undefined</code>.</p>
  
  <p>I can check when loader is finished by using:</p>
  
  <pre><code>Loader.addEventListener('complete', () =&gt; console.log('loader has finished');
  </code></pre>
  
  <p>My question is if I can export the module only if the loader has finished?</p>
  
  <p>Is there a better way of doing this?</p>