1 module libwasm.bindings.CustomEvent;
2 
3 import libwasm.types;
4 
5 import memutils.ct: tuple;
6 import libwasm.bindings.Event;
7 
8 @safe:
9 nothrow:
10 
11 struct CustomEvent {
12   nothrow:
13   libwasm.bindings.Event.Event _parent;
14   alias _parent this;
15   this(Handle h) {
16     _parent = .Event(h);
17   }
18   auto detail()() {
19     return Any(Object_Getter__Handle(this._parent, "detail"));
20   }
21   void initCustomEvent(T3)(string type, bool canBubble /* = false */, bool cancelable /* = false */, scope auto ref T3 detail /* = null */) {
22     // Any
23     Handle _handle_detail = getOrCreateHandle(detail);
24     Serialize_Object_VarArgCall!void(this._parent, "initCustomEvent", "string;bool;bool;Handle", tuple(type, canBubble, cancelable, _handle_detail));
25     dropHandle!(T3)(_handle_detail);
26   }
27   void initCustomEvent()(string type, bool canBubble /* = false */, bool cancelable /* = false */) {
28     Serialize_Object_VarArgCall!void(this._parent, "initCustomEvent", "string;bool;bool", tuple(type, canBubble, cancelable));
29   }
30   void initCustomEvent()(string type, bool canBubble /* = false */) {
31     Serialize_Object_VarArgCall!void(this._parent, "initCustomEvent", "string;bool", tuple(type, canBubble));
32   }
33   void initCustomEvent()(string type) {
34     Object_Call_string__void(this._parent, "initCustomEvent", type);
35   }
36 }
37 struct CustomEventInit {
38   nothrow:
39   libwasm.bindings.Event.EventInit _parent;
40   alias _parent this;
41   this(Handle h) {
42     _parent = .EventInit(h);
43   }
44   static auto create() {
45     return CustomEventInit(libwasm_add__object());
46   }
47   void detail(T0)(scope auto ref T0 detail) {
48     import std.traits : isNumeric, isFloatingPoint, isSomeString;
49     if (isSomeString!T0) {
50       Object_Call_string__void(this._parent, "detail", cast(string) detail);
51       return;
52     } else if (isNumeric!T0 && !isFloatingPoint!T0) {
53       Object_Call_long__void(this._parent, "detail", cast(long) detail);
54       return;
55     } else if (isFloatingPoint!T0) {
56       Object_Call_double__void(this._parent, "detail", cast(double) detail);
57       return;
58     }
59     // Any
60     Handle _handle_detail = getOrCreateHandle(detail);
61     Object_Call_Handle__void(this._parent, "detail", _handle_detail);
62     dropHandle!(T0)(_handle_detail);
63   }
64   auto detail()() {
65     return Any(Object_Getter__Handle(this._parent, "detail"));
66   }
67 }
68 
69