mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 23:08:13 -05:00
33 lines
731 B
JavaScript
33 lines
731 B
JavaScript
|
import { InvalidStateError } from "./lib/errors.js";
|
||
|
import FakeEventTarget from "./lib/FakeEventTarget.js";
|
||
|
class FDBRequest extends FakeEventTarget {
|
||
|
_result = null;
|
||
|
_error = null;
|
||
|
source = null;
|
||
|
transaction = null;
|
||
|
readyState = "pending";
|
||
|
onsuccess = null;
|
||
|
onerror = null;
|
||
|
get error() {
|
||
|
if (this.readyState === "pending") {
|
||
|
throw new InvalidStateError();
|
||
|
}
|
||
|
return this._error;
|
||
|
}
|
||
|
set error(value) {
|
||
|
this._error = value;
|
||
|
}
|
||
|
get result() {
|
||
|
if (this.readyState === "pending") {
|
||
|
throw new InvalidStateError();
|
||
|
}
|
||
|
return this._result;
|
||
|
}
|
||
|
set result(value) {
|
||
|
this._result = value;
|
||
|
}
|
||
|
toString() {
|
||
|
return "[object IDBRequest]";
|
||
|
}
|
||
|
}
|
||
|
export default FDBRequest;
|