export class Locker { #locked = false lock(fn: () => R) { this.#locked = true const result = fn() this.#locked = false return result } get locked() { return this.#locked } }