ui: make closable popups singleton to avoid blocking the ui when there are many (ie errors)
This commit is contained in:
parent
eaf6ac84b5
commit
d9ed3d4853
1 changed files with 13 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue