Skip to content

Set options params to single type, move direction to getter/setter, event listener deallocation? #3

@thaylin79

Description

@thaylin79

Just a couple of thoughts:

constructor(wrapper, {direction:'above', getBoundingRect:null} = {}) {
    this.wrapper = wrapper;
    this.options = {direction, getBoundingRect}
    this.pointer = wrapper.appendChild(elt('div', { class: prefix + '-pointer-' + this.dir + ' ' + prefix + '-pointer' }));
    this.pointerWidth = this.pointerHeight = null;
    this.dom = wrapper.appendChild(elt('div', { class: prefix }));
    this.dom.addEventListener('transitionend', () => {
      if (this.dom.style.opacity == '0')
        this.dom.style.display = this.pointer.style.display = '';
    });
    this.isOpen = false;
    this.lastLeft = this.lastTop = null;
  }
//there doesn't really seem to be a reason NOT to just name this "direction"
  get dir(){ return this.options.direction}
  set dir(val){
  if(val === this.options.direction) return;
  this.options.direction = val;
  }
....
  // :: ()
  // Remove the tooltip from the DOM.
  detach() {
    // DOES THE TRANSITION END LISTENER GET REMOVED AUTOMATICALLY?
    this.dom.parentNode.removeChild(this.dom);
    this.pointer.parentNode.removeChild(this.pointer);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions