lib/Models/TimeSeriesStack.js
function(clock) {
  this.clock = clock;

  this._layerStack = [];

  knockout.track(this, ["_layerStack"]);

  /**
   * The highest time-series layer, or undefined if there are no time series layers.
   */
  knockout.defineProperty(this, "topLayer", {
    get: function() {
      if (this._layerStack.length) {
        return this._layerStack[this._layerStack.length - 1];
      }
      return undefined;
    }
  });

  knockout.getObservable(this, "topLayer").subscribe(function(topLayer) {
    if (defined(topLayer)) {
      // If there's a top layer, make the clock track it.
      this.clock.setCatalogItem(this.topLayer);
    } else {
      // If there's no layers, stop the clock from running.
      this.clock.shouldAnimate = false;
    }
  }, this);
}
function(clock) {
  this.clock = clock;

  this._layerStack = [];

  knockout.track(this, ["_layerStack"]);

  /**
   * The highest time-series layer, or undefined if there are no time series layers.
   */
  knockout.defineProperty(this, "topLayer", {
    get: function() {
      if (this._layerStack.length) {
        return this._layerStack[this._layerStack.length - 1];
      }
      return undefined;
    }
  });

  knockout.getObservable(this, "topLayer").subscribe(function(topLayer) {
    if (defined(topLayer)) {
      // If there's a top layer, make the clock track it.
      this.clock.setCatalogItem(this.topLayer);
    } else {
      // If there's no layers, stop the clock from running.
      this.clock.shouldAnimate = false;
    }
  }, this);
}
function ( clock ) { this . clock = clock ; this . _layerStack = [ ] ; knockout . track ( this , [ "_layerStack" ] ) ; /**
   * The highest time-series layer, or undefined if there are no time series layers.
   */ knockout . defineProperty ( this , "topLayer" , { get : function ( ) { if ( this . _layerStack . length ) { return this . _layerStack [ this . _layerStack . length - 1 ] ; } return undefined ; } } ) ; knockout . getObservable ( this , "topLayer" ) . subscribe ( function ( topLayer ) { if ( defined ( topLayer ) ) { // If there's a top layer, make the clock track it. this . clock . setCatalogItem ( this . topLayer ) ; } else { // If there's no layers, stop the clock from running. this . clock . shouldAnimate = false ; } } , this ) ; }
Manages a stack of all the time series layers currently being shown and makes sure the clock provided is always tracking
the highest one. When the top-most layer is disabled, the clock will track the next highest in the stack. Provides access
to the current top layer so that can be displayed to the user.

@param clock The clock that should track the highest layer.
@constructor
Manages a stack of all the time series layers currently being shown and makes sure the clock provided is always tracking the highest one . When the top - most layer is disabled the clock will track the next highest in the stack . Provides access to the current top layer so that can be displayed to the user .