lib/global.js
function(obj, type, name, nameIsUnique, oldName) {
    var nameMap, objList

    this._store[type] = nameMap = this._store[type] || {}
    nameMap[name] = objList = nameMap[name] || []

    // Adding new mapping
    if (objList.indexOf(obj) === -1) {
      if (nameIsUnique && objList.length > 0)
        throw new Error('there is already a ' + type + ' with name "' + name + '"')
      objList.push(obj)
    }

    // Removing old mapping
    if (oldName) {
      objList = nameMap[oldName]
      objList.splice(objList.indexOf(obj), 1)
    }

    exports.emitter.emit('namedObjects:registered:' + type, obj)
  }
function(obj, type, name, nameIsUnique, oldName) {
    var nameMap, objList

    this._store[type] = nameMap = this._store[type] || {}
    nameMap[name] = objList = nameMap[name] || []

    // Adding new mapping
    if (objList.indexOf(obj) === -1) {
      if (nameIsUnique && objList.length > 0)
        throw new Error('there is already a ' + type + ' with name "' + name + '"')
      objList.push(obj)
    }

    // Removing old mapping
    if (oldName) {
      objList = nameMap[oldName]
      objList.splice(objList.indexOf(obj), 1)
    }

    exports.emitter.emit('namedObjects:registered:' + type, obj)
  }
function ( obj , type , name , nameIsUnique , oldName ) { var nameMap , objList this . _store [ type ] = nameMap = this . _store [ type ] || { } nameMap [ name ] = objList = nameMap [ name ] || [ ] // Adding new mapping if ( objList . indexOf ( obj ) === - 1 ) { if ( nameIsUnique && objList . length > 0 ) throw new Error ( 'there is already a ' + type + ' with name "' + name + '"' ) objList . push ( obj ) } // Removing old mapping if ( oldName ) { objList = nameMap [ oldName ] objList . splice ( objList . indexOf ( obj ) , 1 ) } exports . emitter . emit ( 'namedObjects:registered:' + type , obj ) }
Registers a named object in the store.
Registers a named object in the store .