import { openPromise } from "./util/openPromise.js"; export class AsyncCondition { _waitPromise: Promise; _resolveWaitPromise: () => void; constructor() { const op = openPromise(); this._waitPromise = op.promise; this._resolveWaitPromise = op.resolve; } wait(): Promise { return this._waitPromise; } trigger(): void { this._resolveWaitPromise(); const op = openPromise(); this._waitPromise = op.promise; this._resolveWaitPromise = op.resolve; } } export enum TransactionLevel { None = 0, Read = 1, Write = 2, VersionChange = 3, }