benchmarks/scenarios/ember.js
function (typesAdded, typesUpdated) {
      var _this = this;

      var modelTypes = this.getModelTypes();
      var releaseMethods = _emberRuntimeSystemNative_array.A();
      var typesToSend;

      typesToSend = modelTypes.map(function (type) {
        var klass = type.klass;
        var wrapped = _this.wrapModelType(klass, type.name);
        releaseMethods.push(_this.observeModelType(type.name, typesUpdated));
        return wrapped;
      });

      typesAdded(typesToSend);

      var release = function () {
        releaseMethods.forEach(function (fn) {
          return fn();
        });
        _this.releaseMethods.removeObject(release);
      };
      this.releaseMethods.pushObject(release);
      return release;
    }
function (typesAdded, typesUpdated) {
      var _this = this;

      var modelTypes = this.getModelTypes();
      var releaseMethods = _emberRuntimeSystemNative_array.A();
      var typesToSend;

      typesToSend = modelTypes.map(function (type) {
        var klass = type.klass;
        var wrapped = _this.wrapModelType(klass, type.name);
        releaseMethods.push(_this.observeModelType(type.name, typesUpdated));
        return wrapped;
      });

      typesAdded(typesToSend);

      var release = function () {
        releaseMethods.forEach(function (fn) {
          return fn();
        });
        _this.releaseMethods.removeObject(release);
      };
      this.releaseMethods.pushObject(release);
      return release;
    }
function ( typesAdded , typesUpdated ) { var _this = this ; var modelTypes = this . getModelTypes ( ) ; var releaseMethods = _emberRuntimeSystemNative_array . A ( ) ; var typesToSend ; typesToSend = modelTypes . map ( function ( type ) { var klass = type . klass ; var wrapped = _this . wrapModelType ( klass , type . name ) ; releaseMethods . push ( _this . observeModelType ( type . name , typesUpdated ) ) ; return wrapped ; } ) ; typesAdded ( typesToSend ) ; var release = function ( ) { releaseMethods . forEach ( function ( fn ) { return fn ( ) ; } ) ; _this . releaseMethods . removeObject ( release ) ; } ; this . releaseMethods . pushObject ( release ) ; return release ; }
Fetch the model types and observe them for changes.
@public
@method watchModelTypes
@param {Function} typesAdded Callback to call to add types.
Takes an array of objects containing wrapped types (returned from `wrapModelType`).
@param {Function} typesUpdated Callback to call when a type has changed.
Takes an array of objects containing wrapped types.
@return {Function} Method to call to remove all observers
Fetch the model types and observe them for changes .