text: /**
   * util-events.js - The minimal events support
   */
  
  var eventsCache = seajs.events = {}
  
  // Bind event
  seajs.on = function(event, callback) {
    if (!callback) return seajs
  
    var list = eventsCache[event] || (eventsCache[event] = [])
    list.push(callback)
  
    return seajs
  }
  
  // Remove event. If `callback` is undefined, remove all callbacks for the
  // event. If `event` and `callback` are both undefined, remove all callbacks
  // for all events
  seajs.off = function(event, callback) {
    // Remove *all* events
    if (!(event || callback)) {
      seajs.events = eventsCache = {}
      return seajs
    }
  
    var list = eventsCache[event]
    if (list) {
      if (callback) {
        for (var i = list.length - 1; i >= 0; i--) {
          if (list[i] === callback) {
            list.splice(i, 1)
          }
        }
      }
      else {
        delete eventsCache[event]
      }
    }
  
    return seajs
  }
  
  // Emit event, firing all bound callbacks. Callbacks are passed the same
  // arguments as `emit` is, apart from the event name
  var emit = seajs.emit = function(event, data) {
    var list = eventsCache[event], fn
  
    if (list) {
      // Copy callback lists to prevent modification
      list = list.slice()
  
      // Execute event callbacks
      while ((fn = list.shift())) {
        fn(data)
      }
    }
  
    return seajs
  }
  
  // Emit event and return the specified property of the data
  function emitData(event, data, prop) {
    emit(event, data)
    return data[prop]
  }
  
  
  