From d9ed3d48535a140809ed6d8e8c4aa57b2706fb01 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 25 Feb 2018 09:30:45 +0100 Subject: [PATCH] ui: make closable popups singleton to avoid blocking the ui when there are many (ie errors) --- src/browser/js/app/ui/utils.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/browser/js/app/ui/utils.js b/src/browser/js/app/ui/utils.js index c9892498..db9e415e 100644 --- a/src/browser/js/app/ui/utils.js +++ b/src/browser/js/app/ui/utils.js @@ -1,9 +1,22 @@ +var popupSingleton = null + module.exports = { Popup: class Popup { constructor(options) { + if (options.closable) { + + if (popupSingleton) { + popupSingleton.close() + popupSingleton = null + } + + popupSingleton = this + + } + this.closable = options.closable this.escKey = options.closable || options.escKey this.enterKey = options.enterKey