packages/odo-viewport/dist/odo-viewport.js
function ViewportItem(options, parent) {
      classCallCheck(this, ViewportItem);

      this.parent = parent;
      this.id = Math.random().toString(36).substring(7);
      this.triggered = false;
      this.threshold = 200;
      this.isThresholdPercentage = false;

      // Override defaults with options.
      Object.assign(this, options);

      // The whole point is to have a callback function. Don't do anything if it's not given.
      if (typeof this.enter !== 'function') {
        throw new TypeError('Viewport.add :: No `enter` function provided in Viewport options.');
      }

      this.parseThreshold();

      this.hasExitCallback = typeof this.exit === 'function';

      // Cache element's offsets and dimensions.
      this.update();
    }
function ViewportItem(options, parent) {
      classCallCheck(this, ViewportItem);

      this.parent = parent;
      this.id = Math.random().toString(36).substring(7);
      this.triggered = false;
      this.threshold = 200;
      this.isThresholdPercentage = false;

      // Override defaults with options.
      Object.assign(this, options);

      // The whole point is to have a callback function. Don't do anything if it's not given.
      if (typeof this.enter !== 'function') {
        throw new TypeError('Viewport.add :: No `enter` function provided in Viewport options.');
      }

      this.parseThreshold();

      this.hasExitCallback = typeof this.exit === 'function';

      // Cache element's offsets and dimensions.
      this.update();
    }
function ViewportItem ( options , parent ) { classCallCheck ( this , ViewportItem ) ; this . parent = parent ; this . id = Math . random ( ) . toString ( 36 ) . substring ( 7 ) ; this . triggered = false ; this . threshold = 200 ; this . isThresholdPercentage = false ; // Override defaults with options. Object . assign ( this , options ) ; // The whole point is to have a callback function. Don't do anything if it's not given. if ( typeof this . enter !== 'function' ) { throw new TypeError ( 'Viewport.add :: No `enter` function provided in Viewport options.' ) ; } this . parseThreshold ( ) ; this . hasExitCallback = typeof this . exit === 'function' ; // Cache element's offsets and dimensions. this . update ( ) ; }
A viewport item represents an element being watched by the Viewport component.
@param {Object} options Viewport item options.
@param {Viewport} parent A reference to the viewport.
@constructor
A viewport item represents an element being watched by the Viewport component .