src/Placement.js
/**
         * Interval function to check viewability of registered elements
         * @private
         */
Interval function to check viewability of registered elements
@private
Interval function to check viewability of registered elements @private
_checkViewWatchers() {
            for (let i = 0, controller; i < this._viewedWatchers.length; i++) {
                controller = this._viewedWatchers[i];
                if (okanjo.ui.isElementVisible(controller.element) &&
                    okanjo.ui.getPercentageInViewport(controller.element) >= MINIMUM_VIEW_PX) {
                    controller.successfulCount++;
                }
                if (controller.successfulCount >= MINIMUM_VIEW_FREQ) {
                    controller.handler();
                    this._viewedWatchers.splice(i, 1);
                    i--;
                }
            }
            if (this._viewedWatchers.length === 0) {
                this._toggleViewWatcher(false);
            }
        }
_checkViewWatchers ( ) { for ( let i = 0 , controller ; i < this . _viewedWatchers . length ; i ++ ) { controller = this . _viewedWatchers [ i ] ; if ( okanjo . ui . isElementVisible ( controller . element ) && okanjo . ui . getPercentageInViewport ( controller . element ) >= MINIMUM_VIEW_PX ) { controller . successfulCount ++ ; } if ( controller . successfulCount >= MINIMUM_VIEW_FREQ ) { controller . handler ( ) ; this . _viewedWatchers . splice ( i , 1 ) ; i -- ; } } if ( this . _viewedWatchers . length === 0 ) { this . _toggleViewWatcher ( false ) ; } }
Interval function to check viewability of registered elements
 @private
Interval function to check viewability of registered elements @private
// Check each registered watcher // Check if watcher is complete, then remove it from the list /* istanbul ignore next: jsdom won't trigger this */ // While this could more optimally be contained within the former condition, unit-testing blocks on this // Turn off if nobody is watching