• function

bind

 

steal.bind( event, handler(eventData...) )

Listens to events on steal. Typically these are used by various build processes to know when steal starts and finish loading resources and their dependencies. Listen to an event like:

steal.bind('end', function(rootModule){
  rootModule.dependencies // the first stolen resources.
})

Steal supports the following events:

  • start - steal has started loading a group of resources and their dependencies.
  • end - steal has finished loading a group of resources and their dependencies.
  • done - steal has finished loading the first set of resources and their dependencies.
  • ready - after both steal's "done" event and the window's onload event have fired.

For example, the following html:

<script src='steal/steal.js'></script>
<script>
steal('can/control', function(){
  setTimeout(function(){
    steal('can/model')    
  },200)
})
</script>

Would fire:

  • start - immediately after steal('can/control') is called
  • end - after 'can/control', all of it's dependencies, and the callback function have executed and completed.
  • done - fired after the first 'end' event.
  • ready - fired after window.onload and the 'done' event
  • start - immediately after steal('can/model') is called
  • end - fired after 'can/model' and all of it's dependencies have fired.

Parameters

  1. event {String}

    the event to listen to

  2. listener {function()}

    a function callback.