1 module libwasm.bindings.IDBRequest;
2 
3 import libwasm.types;
4 
5 import memutils.ct: tuple;
6 import libwasm.bindings.DOMException;
7 import libwasm.bindings.EventHandler;
8 import libwasm.bindings.EventTarget;
9 import libwasm.bindings.IDBCursor;
10 import libwasm.bindings.IDBIndex;
11 import libwasm.bindings.IDBObjectStore;
12 import libwasm.bindings.IDBTransaction;
13 
14 @safe:
15 nothrow:
16 
17 struct IDBRequest {
18   nothrow:
19   libwasm.bindings.EventTarget.EventTarget _parent;
20   alias _parent this;
21   this(Handle h) {
22     _parent = .EventTarget(h);
23   }
24   auto result()() {
25     return Any(Object_Getter__Handle(this._parent, "result"));
26   }
27   auto error()() {
28     return recastOpt!(DOMException)(Object_Getter__OptionalHandle(this._parent, "error"));
29   }
30   auto source()() {
31     return IDBRequest_source_Get(this._parent);
32   }
33   auto transaction()() {
34     return recastOpt!(IDBTransaction)(Object_Getter__OptionalHandle(this._parent, "transaction"));
35   }
36   IDBRequestReadyState readyState()() {
37     return Object_Getter__int(this._parent, "readyState");
38   }
39   void onsuccess(T0)(scope auto ref Optional!(T0) onsuccess) if (isTOrPointer!(T0, EventHandlerNonNull)) {
40     Object_Call_EventHandler__void(this._parent, "onsuccess", !onsuccess.empty, onsuccess.front);
41   }
42   EventHandler onsuccess()() {
43     return Object_Getter__EventHandler(this._parent, "onsuccess");
44   }
45   void onerror(T0)(scope auto ref Optional!(T0) onerror) if (isTOrPointer!(T0, EventHandlerNonNull)) {
46     Object_Call_EventHandler__void(this._parent, "onerror", !onerror.empty, onerror.front);
47   }
48   EventHandler onerror()() {
49     return Object_Getter__EventHandler(this._parent, "onerror");
50   }
51 }
52 enum IDBRequestReadyState {
53   pending,
54   done
55 }
56 
57 
58 extern (C) Optional!(SumType!(IDBObjectStore, IDBIndex, IDBCursor)) IDBRequest_source_Get(Handle);