import {EventEmitter} from "@angular/core"; export class Lock { private isLocked: boolean = false; private lockCounter: number = 0; lock() { this.isLocked = true; this.lockCounter++; } unlock() { this.lockCounter--; if (this.lockCounter === 0) { this.isLocked = false; } } get IsLocked() { return this.isLocked; } }