Skip to content

Commit

Permalink
Removed unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
exdis committed Feb 5, 2019
1 parent d571574 commit 27b74e3
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions client/views/popup.js
Expand Up @@ -59,6 +59,8 @@ function getBoundingRect(element, relElement) {
};
}

const elQueue = new Set();

class Popup {
constructor(options) {
this.options = {
Expand All @@ -69,11 +71,6 @@ class Popup {
this.el = document.createElement('div');
this.el.className = 'discovery-view-popup';

Popup.els = Popup.els || new Set();
Popup.els.add(this.el);

Popup.elQueue = Popup.elQueue || new Set();

this.hide = this.hide.bind(this);
this.hideIfEventOutside = this.hideIfEventOutside.bind(this);
this.hideTimer;
Expand Down Expand Up @@ -124,11 +121,7 @@ class Popup {
const availWidthLeft = box.left - viewport.right - 3;
const availWidthRight = viewport.right - box.left - 3;

[...Popup.els]
.filter(el => el.contains(triggerEl))
.forEach(el => Popup.elQueue.add(el));

Popup.elQueue.add(this.el);
elQueue.add(this.el);

this.hideTimer = clearTimeout(this.hideTimer);

Expand Down Expand Up @@ -190,7 +183,7 @@ class Popup {
this.hideTimer = clearTimeout(this.hideTimer);
this.visible = false;

Popup.elQueue.delete(this.el);
elQueue.delete(this.el);
}
}

Expand All @@ -200,7 +193,7 @@ class Popup {
return;
}

const elQueueArray = [...Popup.elQueue];
const elQueueArray = [...elQueue];

// element in queue on which event was triggered
const elInQueue = elQueueArray.find(el => el.contains(event.target));
Expand Down

0 comments on commit 27b74e3

Please sign in to comment.