//@ts-expect-error
const vaultWorker = VAULT_WORKER
+const LOCKED = 'locked'
+const UNLOCKED = 'unlocked'
export class Vault {
#eventTarget = new EventTarget()
}
#report (results: any): void {
- if (results === 'locked' || results === 'unlocked') {
- const isLocked = results === 'locked'
+ if (results === LOCKED || results === UNLOCKED) {
+ const isLocked = results === LOCKED
if (this.#isLocked !== isLocked) {
this.#isLocked = isLocked
this.dispatchEvent(new Event(results))
return
}
if (this.#job == null) {
- throw new Error('Vault worker returned results but had no job to report it.')
+ throw new Error('Vault worker returned results without an associated job.')
}
const { url, id, resolve, reject } = this.#job
if (url == null) {