mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-03 16:10:31 +00:00
99d96edd9c
* feat: s3 fs in oss * feat: new endpoints in OSS * fix: name of fs extension * perf: signed uploads * fix: await socket events to align fs events * fix: default bucket names * fix: backend tests * fix: deps * fix: order
32 lines
757 B
JavaScript
32 lines
757 B
JavaScript
import { TeePromise } from 'teepromise';
|
|
|
|
export default class BaseOperation {
|
|
static STATUS_PENDING = {};
|
|
static STATUS_RUNNING = {};
|
|
static STATUS_DONE = {};
|
|
|
|
/** @type {PromiseLike<void> & { resolve: () => void }} */
|
|
#donePromise;
|
|
|
|
constructor () {
|
|
this.status_ = this.constructor.STATUS_PENDING;
|
|
this.#donePromise = new TeePromise();
|
|
}
|
|
get status () {
|
|
return this.status_;
|
|
}
|
|
set status (status) {
|
|
this.status_ = status;
|
|
if ( status === this.constructor.STATUS_DONE ) {
|
|
this.#donePromise.resolve();
|
|
}
|
|
}
|
|
async awaitDone () {
|
|
await this.#donePromise;
|
|
}
|
|
async onComplete (fn) {
|
|
await this.#donePromise;
|
|
fn();
|
|
}
|
|
}
|