1 module awebview.wrapper.constants; 2 3 import awebview.wrapper.cpp; 4 5 import awebview.wrapper.jsarray; 6 import awebview.wrapper.jsvalue : JSValue; 7 import awebview.wrapper.webstring : WebString; 8 import awebview.wrapper.weburl : WebURL; 9 import awebview.wrapper.jsobject : JSObject; 10 11 struct JSValueConsts 12 { 13 static shared immutable(JSValue*) _emptyInstance; 14 static shared immutable(JSValue*) _undefined; 15 static shared immutable(JSValue*) _null; 16 17 shared static this() 18 { 19 JSValue* p = new JSValue; 20 JSValueMember.ctor(p.cppObj!false); 21 _emptyInstance = cast(immutable)p; 22 23 JSValue* undefined = new JSValue(JSValueMember.Undefined()); 24 _undefined = cast(immutable)undefined; 25 26 JSValue* null_ = new JSValue(JSValueMember.Null()); 27 _null = cast(immutable)null_; 28 } 29 } 30 31 32 struct JSObjectConsts 33 { 34 static shared immutable(JSObject*) _emptyInstance; 35 36 shared static this() 37 { 38 JSObject* obj = new JSObject; 39 JSObjectMember.ctor(obj.cppObj!false); 40 _emptyInstance = cast(immutable)obj; 41 } 42 } 43 44 45 struct JSArrayConsts 46 { 47 static shared immutable(JSArrayCpp*) _emptyInstance; 48 49 shared static this() 50 { 51 JSArrayCpp* p = new JSArrayCpp; 52 JSArrayMember.ctor(p.cppObj!false); 53 54 _emptyInstance = cast(immutable)p; 55 } 56 }