src/plugins/popper/index.js
function Popper(reference, popper) {
    var _this = this;

    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    classCallCheck(this, Popper);

    this.scheduleUpdate = function () {
      return requestAnimation(_this.update);
    };

    // make update() debounced, so that it only runs at most once-per-tick
    this.update = debounce(this.update.bind(this));

    // with {} we create a new object with the options inside it
    this.defaultOptions = options;
    this.options = _extends({}, Popper.Defaults, options);

    // init state
    this.state = {
      isDestroyed: false,
      isCreated: false,
      scrollParents: []
    };

    // get reference and popper elements (allow jQuery wrappers)
    this.reference = reference && reference.jquery ? reference[0] : reference;
    this.popper = popper && popper.jquery ? popper[0] : popper;

    this.updateModifiers();

    // fire the first update to position the popper in the right place
    this.update();

    var eventsEnabled = this.options.eventsEnabled;
    if (eventsEnabled) {
      // setup event listeners, they will take care of update the position in specific situations
      this.enableEventListeners();
    }

    this.state.eventsEnabled = eventsEnabled;
  }
function Popper(reference, popper) {
    var _this = this;

    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    classCallCheck(this, Popper);

    this.scheduleUpdate = function () {
      return requestAnimation(_this.update);
    };

    // make update() debounced, so that it only runs at most once-per-tick
    this.update = debounce(this.update.bind(this));

    // with {} we create a new object with the options inside it
    this.defaultOptions = options;
    this.options = _extends({}, Popper.Defaults, options);

    // init state
    this.state = {
      isDestroyed: false,
      isCreated: false,
      scrollParents: []
    };

    // get reference and popper elements (allow jQuery wrappers)
    this.reference = reference && reference.jquery ? reference[0] : reference;
    this.popper = popper && popper.jquery ? popper[0] : popper;

    this.updateModifiers();

    // fire the first update to position the popper in the right place
    this.update();

    var eventsEnabled = this.options.eventsEnabled;
    if (eventsEnabled) {
      // setup event listeners, they will take care of update the position in specific situations
      this.enableEventListeners();
    }

    this.state.eventsEnabled = eventsEnabled;
  }
function Popper ( reference , popper ) { var _this = this ; var options = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : { } ; classCallCheck ( this , Popper ) ; this . scheduleUpdate = function ( ) { return requestAnimation ( _this . update ) ; } ; // make update() debounced, so that it only runs at most once-per-tick this . update = debounce ( this . update . bind ( this ) ) ; // with {} we create a new object with the options inside it this . defaultOptions = options ; this . options = _extends ( { } , Popper . Defaults , options ) ; // init state this . state = { isDestroyed : false , isCreated : false , scrollParents : [ ] } ; // get reference and popper elements (allow jQuery wrappers) this . reference = reference && reference . jquery ? reference [ 0 ] : reference ; this . popper = popper && popper . jquery ? popper [ 0 ] : popper ; this . updateModifiers ( ) ; // fire the first update to position the popper in the right place this . update ( ) ; var eventsEnabled = this . options . eventsEnabled ; if ( eventsEnabled ) { // setup event listeners, they will take care of update the position in specific situations this . enableEventListeners ( ) ; } this . state . eventsEnabled = eventsEnabled ; }
Create a new Popper.js instance
@class Popper
@param {HTMLElement|referenceObject} reference - The reference element used to position the popper
@param {HTMLElement} popper - The HTML element used as popper.
@param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
@return {Object} instance - The generated Popper.js instance
Create a new Popper . js instance