lion/docs/fundamentals/tools/singleton-manager/example-complex/node_modules/overlays/index.js
2022-03-30 12:37:30 +02:00

30 lines
715 B
JavaScript

export class OverlaysManager {
name = 'OverlayManager 1.x';
blockBody = false;
constructor() {
this._setupBlocker();
}
_setupBlocker() {
const blocker = document.createElement('div');
blocker.setAttribute('style', 'border: 2px solid #8d0606; margin: 10px; padding: 10px; width: 140px; text-align: center;');
blocker.innerText = `Blocker for ${this.name}`;
const target = document.getElementById('overlay-target');
target.appendChild(blocker);
this.blocker = blocker;
}
block() {
this.blockBody = true;
this.blocker.style.backgroundColor = '#ff6161';
}
unBlock() {
this.blockBody = false;
this.blocker.style.backgroundColor = 'transparent';
}
}