1 module libwasm.bindings.SpeechRecognitionEvent; 2 3 import libwasm.types; 4 5 import memutils.ct: tuple; 6 import libwasm.bindings.Document; 7 import libwasm.bindings.Event; 8 import libwasm.bindings.SpeechRecognitionResultList; 9 10 @safe: 11 nothrow: 12 13 struct SpeechRecognitionEvent { 14 nothrow: 15 libwasm.bindings.Event.Event _parent; 16 alias _parent this; 17 this(Handle h) { 18 _parent = .Event(h); 19 } 20 uint resultIndex()() { 21 return Object_Getter__uint(this._parent, "resultIndex"); 22 } 23 auto results()() { 24 return recastOpt!(SpeechRecognitionResultList)(Object_Getter__OptionalHandle(this._parent, "results")); 25 } 26 auto interpretation()() { 27 return Any(Object_Getter__Handle(this._parent, "interpretation")); 28 } 29 auto emma()() { 30 return recastOpt!(Document)(Object_Getter__OptionalHandle(this._parent, "emma")); 31 } 32 } 33 struct SpeechRecognitionEventInit { 34 nothrow: 35 libwasm.bindings.Event.EventInit _parent; 36 alias _parent this; 37 this(Handle h) { 38 _parent = .EventInit(h); 39 } 40 static auto create() { 41 return SpeechRecognitionEventInit(libwasm_add__object()); 42 } 43 void resultIndex()(uint resultIndex) { 44 Object_Call_uint__void(this._parent, "resultIndex", resultIndex); 45 } 46 uint resultIndex()() { 47 return Object_Getter__uint(this._parent, "resultIndex"); 48 } 49 void results(T0)(scope auto ref Optional!(T0) results) if (isTOrPointer!(T0, SpeechRecognitionResultList)) { 50 Serialize_Object_VarArgCall!void(this._parent, "results", "Optional!Handle", tuple(!results.empty, cast(Handle)results.front.handle)); 51 } 52 auto results()() { 53 return recastOpt!(SpeechRecognitionResultList)(Object_Getter__OptionalHandle(this._parent, "results")); 54 } 55 void interpretation(T0)(scope auto ref T0 interpretation) { 56 import std.traits : isNumeric, isFloatingPoint, isSomeString; 57 if (isSomeString!T0) { 58 Object_Call_string__void(this._parent, "interpretation", cast(string) interpretation); 59 return; 60 } else if (isNumeric!T0 && !isFloatingPoint!T0) { 61 Object_Call_long__void(this._parent, "interpretation", cast(long) interpretation); 62 return; 63 } else if (isFloatingPoint!T0) { 64 Object_Call_double__void(this._parent, "interpretation", cast(double) interpretation); 65 return; 66 } 67 // Any 68 Handle _handle_interpretation = getOrCreateHandle(interpretation); 69 Object_Call_Handle__void(this._parent, "interpretation", _handle_interpretation); 70 dropHandle!(T0)(_handle_interpretation); 71 } 72 auto interpretation()() { 73 return Any(Object_Getter__Handle(this._parent, "interpretation")); 74 } 75 void emma(T0)(scope auto ref Optional!(T0) emma) if (isTOrPointer!(T0, Document)) { 76 Serialize_Object_VarArgCall!void(this._parent, "emma", "Optional!Handle", tuple(!emma.empty, cast(Handle)emma.front._parent)); 77 } 78 auto emma()() { 79 return recastOpt!(Document)(Object_Getter__OptionalHandle(this._parent, "emma")); 80 } 81 } 82 83