diff --git a/abortcontroller.go b/abortcontroller.go index 5695185..c86cc79 100644 --- a/abortcontroller.go +++ b/abortcontroller.go @@ -13,9 +13,12 @@ type AbortController struct { } func JSValueToAbortController(val js.Value) AbortController { - return AbortController{Value: Value{Value: val}} + return AbortController{Value: JSValueToValue(val)} } func (v Value) AsAbortController() AbortController { return AbortController{Value: v} } +func NewAbortController(args ...interface{}) AbortController { + return AbortController{Value: JSValueToValue(js.Global().Get("AbortController").New(args...))} +} func (a AbortController) Abort(args ...interface{}) { a.Call("abort", args...) } diff --git a/abortsignal.go b/abortsignal.go index 8105ef4..ffbb858 100644 --- a/abortsignal.go +++ b/abortsignal.go @@ -17,8 +17,11 @@ type AbortSignal struct { EventTarget } -func JSValueToAbortSignal(val js.Value) AbortSignal { return AbortSignal{Value: Value{Value: val}} } +func JSValueToAbortSignal(val js.Value) AbortSignal { return AbortSignal{Value: JSValueToValue(val)} } func (v Value) AsAbortSignal() AbortSignal { return AbortSignal{Value: v} } +func NewAbortSignal(args ...interface{}) AbortSignal { + return AbortSignal{Value: JSValueToValue(js.Global().Get("AbortSignal").New(args...))} +} func (a AbortSignal) GetAborted() bool { val := a.Get("aborted") return val.Bool() diff --git a/abstractrange.go b/abstractrange.go index 042aa15..f6634e4 100644 --- a/abstractrange.go +++ b/abstractrange.go @@ -16,9 +16,12 @@ type AbstractRange struct { } func JSValueToAbstractRange(val js.Value) AbstractRange { - return AbstractRange{Value: Value{Value: val}} + return AbstractRange{Value: JSValueToValue(val)} } func (v Value) AsAbstractRange() AbstractRange { return AbstractRange{Value: v} } +func NewAbstractRange(args ...interface{}) AbstractRange { + return AbstractRange{Value: JSValueToValue(js.Global().Get("AbstractRange").New(args...))} +} func (a AbstractRange) GetCollapsed() bool { val := a.Get("collapsed") return val.Bool() diff --git a/applicationcache.go b/applicationcache.go index d427de3..04e3d08 100644 --- a/applicationcache.go +++ b/applicationcache.go @@ -35,9 +35,12 @@ type ApplicationCache struct { } func JSValueToApplicationCache(val js.Value) ApplicationCache { - return ApplicationCache{Value: Value{Value: val}} + return ApplicationCache{Value: JSValueToValue(val)} } func (v Value) AsApplicationCache() ApplicationCache { return ApplicationCache{Value: v} } +func NewApplicationCache(args ...interface{}) ApplicationCache { + return ApplicationCache{Value: JSValueToValue(js.Global().Get("ApplicationCache").New(args...))} +} func (a ApplicationCache) Abort(args ...interface{}) { a.Call("abort", args...) } diff --git a/attr.go b/attr.go index 8fb355b..39e9ce3 100644 --- a/attr.go +++ b/attr.go @@ -54,8 +54,11 @@ type Attr struct { EventTarget } -func JSValueToAttr(val js.Value) Attr { return Attr{Value: Value{Value: val}} } +func JSValueToAttr(val js.Value) Attr { return Attr{Value: JSValueToValue(val)} } func (v Value) AsAttr() Attr { return Attr{Value: v} } +func NewAttr(args ...interface{}) Attr { + return Attr{Value: JSValueToValue(js.Global().Get("Attr").New(args...))} +} func (a Attr) GetLocalName() string { val := a.Get("localName") return val.String() diff --git a/audiotrack.go b/audiotrack.go index c6ad6be..fb59665 100644 --- a/audiotrack.go +++ b/audiotrack.go @@ -16,8 +16,11 @@ type AudioTrack struct { Value } -func JSValueToAudioTrack(val js.Value) AudioTrack { return AudioTrack{Value: Value{Value: val}} } +func JSValueToAudioTrack(val js.Value) AudioTrack { return AudioTrack{Value: JSValueToValue(val)} } func (v Value) AsAudioTrack() AudioTrack { return AudioTrack{Value: v} } +func NewAudioTrack(args ...interface{}) AudioTrack { + return AudioTrack{Value: JSValueToValue(js.Global().Get("AudioTrack").New(args...))} +} func (a AudioTrack) GetEnabled() bool { val := a.Get("enabled") return val.Bool() diff --git a/audiotracklist.go b/audiotracklist.go index d7f6193..4ae2eb8 100644 --- a/audiotracklist.go +++ b/audiotracklist.go @@ -23,9 +23,12 @@ type AudioTrackList struct { } func JSValueToAudioTrackList(val js.Value) AudioTrackList { - return AudioTrackList{Value: Value{Value: val}} + return AudioTrackList{Value: JSValueToValue(val)} } func (v Value) AsAudioTrackList() AudioTrackList { return AudioTrackList{Value: v} } +func NewAudioTrackList(args ...interface{}) AudioTrackList { + return AudioTrackList{Value: JSValueToValue(js.Global().Get("AudioTrackList").New(args...))} +} func (a AudioTrackList) GetTrackById(args ...interface{}) AudioTrack { val := a.Call("getTrackById", args...) return JSValueToAudioTrack(val.JSValue()) diff --git a/barprop.go b/barprop.go index c315632..458fdc4 100644 --- a/barprop.go +++ b/barprop.go @@ -11,8 +11,11 @@ type BarProp struct { Value } -func JSValueToBarProp(val js.Value) BarProp { return BarProp{Value: Value{Value: val}} } +func JSValueToBarProp(val js.Value) BarProp { return BarProp{Value: JSValueToValue(val)} } func (v Value) AsBarProp() BarProp { return BarProp{Value: v} } +func NewBarProp(args ...interface{}) BarProp { + return BarProp{Value: JSValueToValue(js.Global().Get("BarProp").New(args...))} +} func (b BarProp) GetVisible() bool { val := b.Get("visible") return val.Bool() diff --git a/beforeunloadevent.go b/beforeunloadevent.go index 2786dec..35482c6 100644 --- a/beforeunloadevent.go +++ b/beforeunloadevent.go @@ -32,9 +32,12 @@ type BeforeUnloadEvent struct { } func JSValueToBeforeUnloadEvent(val js.Value) BeforeUnloadEvent { - return BeforeUnloadEvent{Value: Value{Value: val}} + return BeforeUnloadEvent{Value: JSValueToValue(val)} } func (v Value) AsBeforeUnloadEvent() BeforeUnloadEvent { return BeforeUnloadEvent{Value: v} } +func NewBeforeUnloadEvent(args ...interface{}) BeforeUnloadEvent { + return BeforeUnloadEvent{Value: JSValueToValue(js.Global().Get("BeforeUnloadEvent").New(args...))} +} func (b BeforeUnloadEvent) GetReturnValue() string { val := b.Get("returnValue") return val.String() diff --git a/blob.go b/blob.go index 0bfd24e..2210fae 100644 --- a/blob.go +++ b/blob.go @@ -13,8 +13,11 @@ type Blob struct { Value } -func JSValueToBlob(val js.Value) Blob { return Blob{Value: Value{Value: val}} } +func JSValueToBlob(val js.Value) Blob { return Blob{Value: JSValueToValue(val)} } func (v Value) AsBlob() Blob { return Blob{Value: v} } +func NewBlob(args ...interface{}) Blob { + return Blob{Value: JSValueToValue(js.Global().Get("Blob").New(args...))} +} func (b Blob) GetSize() int { val := b.Get("size") return val.Int() diff --git a/broadcastchannel.go b/broadcastchannel.go index e6147fa..899ccc9 100644 --- a/broadcastchannel.go +++ b/broadcastchannel.go @@ -22,9 +22,12 @@ type BroadcastChannel struct { } func JSValueToBroadcastChannel(val js.Value) BroadcastChannel { - return BroadcastChannel{Value: Value{Value: val}} + return BroadcastChannel{Value: JSValueToValue(val)} } func (v Value) AsBroadcastChannel() BroadcastChannel { return BroadcastChannel{Value: v} } +func NewBroadcastChannel(args ...interface{}) BroadcastChannel { + return BroadcastChannel{Value: JSValueToValue(js.Global().Get("BroadcastChannel").New(args...))} +} func (b BroadcastChannel) Close(args ...interface{}) { b.Call("close", args...) } diff --git a/canvasgradient.go b/canvasgradient.go index 8a43fda..3f8cbc5 100644 --- a/canvasgradient.go +++ b/canvasgradient.go @@ -12,9 +12,12 @@ type CanvasGradient struct { } func JSValueToCanvasGradient(val js.Value) CanvasGradient { - return CanvasGradient{Value: Value{Value: val}} + return CanvasGradient{Value: JSValueToValue(val)} } func (v Value) AsCanvasGradient() CanvasGradient { return CanvasGradient{Value: v} } +func NewCanvasGradient(args ...interface{}) CanvasGradient { + return CanvasGradient{Value: JSValueToValue(js.Global().Get("CanvasGradient").New(args...))} +} func (c CanvasGradient) AddColorStop(args ...interface{}) { c.Call("addColorStop", args...) } diff --git a/canvaspattern.go b/canvaspattern.go index 539811e..4ee1295 100644 --- a/canvaspattern.go +++ b/canvaspattern.go @@ -12,9 +12,12 @@ type CanvasPattern struct { } func JSValueToCanvasPattern(val js.Value) CanvasPattern { - return CanvasPattern{Value: Value{Value: val}} + return CanvasPattern{Value: JSValueToValue(val)} } func (v Value) AsCanvasPattern() CanvasPattern { return CanvasPattern{Value: v} } +func NewCanvasPattern(args ...interface{}) CanvasPattern { + return CanvasPattern{Value: JSValueToValue(js.Global().Get("CanvasPattern").New(args...))} +} func (c CanvasPattern) SetTransform(args ...interface{}) { c.Call("setTransform", args...) } diff --git a/canvasrenderingcontext2d.go b/canvasrenderingcontext2d.go index a6c2af3..faf92cf 100644 --- a/canvasrenderingcontext2d.go +++ b/canvasrenderingcontext2d.go @@ -103,11 +103,14 @@ type CanvasRenderingContext2D struct { } func JSValueToCanvasRenderingContext2D(val js.Value) CanvasRenderingContext2D { - return CanvasRenderingContext2D{Value: Value{Value: val}} + return CanvasRenderingContext2D{Value: JSValueToValue(val)} } func (v Value) AsCanvasRenderingContext2D() CanvasRenderingContext2D { return CanvasRenderingContext2D{Value: v} } +func NewCanvasRenderingContext2D(args ...interface{}) CanvasRenderingContext2D { + return CanvasRenderingContext2D{Value: JSValueToValue(js.Global().Get("CanvasRenderingContext2D").New(args...))} +} func (c CanvasRenderingContext2D) Arc(args ...interface{}) { c.Call("arc", args...) } diff --git a/cdatasection.go b/cdatasection.go index 00c350f..f7aff9a 100644 --- a/cdatasection.go +++ b/cdatasection.go @@ -58,5 +58,8 @@ type CDATASection struct { EventTarget } -func JSValueToCDATASection(val js.Value) CDATASection { return CDATASection{Value: Value{Value: val}} } +func JSValueToCDATASection(val js.Value) CDATASection { return CDATASection{Value: JSValueToValue(val)} } func (v Value) AsCDATASection() CDATASection { return CDATASection{Value: v} } +func NewCDATASection(args ...interface{}) CDATASection { + return CDATASection{Value: JSValueToValue(js.Global().Get("CDATASection").New(args...))} +} diff --git a/characterdata.go b/characterdata.go index 62e8533..3c753ec 100644 --- a/characterdata.go +++ b/characterdata.go @@ -61,9 +61,12 @@ type CharacterData struct { } func JSValueToCharacterData(val js.Value) CharacterData { - return CharacterData{Value: Value{Value: val}} + return CharacterData{Value: JSValueToValue(val)} } func (v Value) AsCharacterData() CharacterData { return CharacterData{Value: v} } +func NewCharacterData(args ...interface{}) CharacterData { + return CharacterData{Value: JSValueToValue(js.Global().Get("CharacterData").New(args...))} +} func (c CharacterData) After(args ...interface{}) { c.Call("after", args...) } diff --git a/closeevent.go b/closeevent.go index 4336327..a473c46 100644 --- a/closeevent.go +++ b/closeevent.go @@ -34,8 +34,11 @@ type CloseEvent struct { Event } -func JSValueToCloseEvent(val js.Value) CloseEvent { return CloseEvent{Value: Value{Value: val}} } +func JSValueToCloseEvent(val js.Value) CloseEvent { return CloseEvent{Value: JSValueToValue(val)} } func (v Value) AsCloseEvent() CloseEvent { return CloseEvent{Value: v} } +func NewCloseEvent(args ...interface{}) CloseEvent { + return CloseEvent{Value: JSValueToValue(js.Global().Get("CloseEvent").New(args...))} +} func (c CloseEvent) GetCode() int { val := c.Get("code") return val.Int() diff --git a/comment.go b/comment.go index eb0e8f6..d2b71bb 100644 --- a/comment.go +++ b/comment.go @@ -55,5 +55,8 @@ type Comment struct { EventTarget } -func JSValueToComment(val js.Value) Comment { return Comment{Value: Value{Value: val}} } +func JSValueToComment(val js.Value) Comment { return Comment{Value: JSValueToValue(val)} } func (v Value) AsComment() Comment { return Comment{Value: v} } +func NewComment(args ...interface{}) Comment { + return Comment{Value: JSValueToValue(js.Global().Get("Comment").New(args...))} +} diff --git a/cssgroupingrule.go b/cssgroupingrule.go index 109d619..cb63db1 100644 --- a/cssgroupingrule.go +++ b/cssgroupingrule.go @@ -20,9 +20,12 @@ type CSSGroupingRule struct { } func JSValueToCSSGroupingRule(val js.Value) CSSGroupingRule { - return CSSGroupingRule{Value: Value{Value: val}} + return CSSGroupingRule{Value: JSValueToValue(val)} } func (v Value) AsCSSGroupingRule() CSSGroupingRule { return CSSGroupingRule{Value: v} } +func NewCSSGroupingRule(args ...interface{}) CSSGroupingRule { + return CSSGroupingRule{Value: JSValueToValue(js.Global().Get("CSSGroupingRule").New(args...))} +} func (c CSSGroupingRule) GetCssRules() CSSRuleList { val := c.Get("cssRules") return JSValueToCSSRuleList(val.JSValue()) diff --git a/cssimportrule.go b/cssimportrule.go index 8556100..0d02b6b 100644 --- a/cssimportrule.go +++ b/cssimportrule.go @@ -20,9 +20,12 @@ type CSSImportRule struct { } func JSValueToCSSImportRule(val js.Value) CSSImportRule { - return CSSImportRule{Value: Value{Value: val}} + return CSSImportRule{Value: JSValueToValue(val)} } func (v Value) AsCSSImportRule() CSSImportRule { return CSSImportRule{Value: v} } +func NewCSSImportRule(args ...interface{}) CSSImportRule { + return CSSImportRule{Value: JSValueToValue(js.Global().Get("CSSImportRule").New(args...))} +} func (c CSSImportRule) GetHref() string { val := c.Get("href") return val.String() diff --git a/cssmarginrule.go b/cssmarginrule.go index 4e36750..8efc82d 100644 --- a/cssmarginrule.go +++ b/cssmarginrule.go @@ -19,9 +19,12 @@ type CSSMarginRule struct { } func JSValueToCSSMarginRule(val js.Value) CSSMarginRule { - return CSSMarginRule{Value: Value{Value: val}} + return CSSMarginRule{Value: JSValueToValue(val)} } func (v Value) AsCSSMarginRule() CSSMarginRule { return CSSMarginRule{Value: v} } +func NewCSSMarginRule(args ...interface{}) CSSMarginRule { + return CSSMarginRule{Value: JSValueToValue(js.Global().Get("CSSMarginRule").New(args...))} +} func (c CSSMarginRule) GetName() string { val := c.Get("name") return val.String() diff --git a/cssnamespacerule.go b/cssnamespacerule.go index 9083192..1113d53 100644 --- a/cssnamespacerule.go +++ b/cssnamespacerule.go @@ -19,9 +19,12 @@ type CSSNamespaceRule struct { } func JSValueToCSSNamespaceRule(val js.Value) CSSNamespaceRule { - return CSSNamespaceRule{Value: Value{Value: val}} + return CSSNamespaceRule{Value: JSValueToValue(val)} } func (v Value) AsCSSNamespaceRule() CSSNamespaceRule { return CSSNamespaceRule{Value: v} } +func NewCSSNamespaceRule(args ...interface{}) CSSNamespaceRule { + return CSSNamespaceRule{Value: JSValueToValue(js.Global().Get("CSSNamespaceRule").New(args...))} +} func (c CSSNamespaceRule) GetNamespaceURI() string { val := c.Get("namespaceURI") return val.String() diff --git a/csspagerule.go b/csspagerule.go index 33535a6..a9d8626 100644 --- a/csspagerule.go +++ b/csspagerule.go @@ -23,8 +23,11 @@ type CSSPageRule struct { CSSRule } -func JSValueToCSSPageRule(val js.Value) CSSPageRule { return CSSPageRule{Value: Value{Value: val}} } +func JSValueToCSSPageRule(val js.Value) CSSPageRule { return CSSPageRule{Value: JSValueToValue(val)} } func (v Value) AsCSSPageRule() CSSPageRule { return CSSPageRule{Value: v} } +func NewCSSPageRule(args ...interface{}) CSSPageRule { + return CSSPageRule{Value: JSValueToValue(js.Global().Get("CSSPageRule").New(args...))} +} func (c CSSPageRule) GetSelectorText() string { val := c.Get("selectorText") return val.String() diff --git a/cssrule.go b/cssrule.go index a709994..e5f5c09 100644 --- a/cssrule.go +++ b/cssrule.go @@ -15,8 +15,11 @@ type CSSRule struct { Value } -func JSValueToCSSRule(val js.Value) CSSRule { return CSSRule{Value: Value{Value: val}} } +func JSValueToCSSRule(val js.Value) CSSRule { return CSSRule{Value: JSValueToValue(val)} } func (v Value) AsCSSRule() CSSRule { return CSSRule{Value: v} } +func NewCSSRule(args ...interface{}) CSSRule { + return CSSRule{Value: JSValueToValue(js.Global().Get("CSSRule").New(args...))} +} func (c CSSRule) GetCssText() string { val := c.Get("cssText") return val.String() diff --git a/cssrulelist.go b/cssrulelist.go index 0257d86..b51d977 100644 --- a/cssrulelist.go +++ b/cssrulelist.go @@ -12,8 +12,11 @@ type CSSRuleList struct { Value } -func JSValueToCSSRuleList(val js.Value) CSSRuleList { return CSSRuleList{Value: Value{Value: val}} } +func JSValueToCSSRuleList(val js.Value) CSSRuleList { return CSSRuleList{Value: JSValueToValue(val)} } func (v Value) AsCSSRuleList() CSSRuleList { return CSSRuleList{Value: v} } +func NewCSSRuleList(args ...interface{}) CSSRuleList { + return CSSRuleList{Value: JSValueToValue(js.Global().Get("CSSRuleList").New(args...))} +} func (c CSSRuleList) Item(args ...interface{}) CSSRule { val := c.Call("item", args...) return JSValueToCSSRule(val.JSValue()) diff --git a/cssstyledeclaration.go b/cssstyledeclaration.go index 205dcc2..7f3a659 100644 --- a/cssstyledeclaration.go +++ b/cssstyledeclaration.go @@ -28,9 +28,12 @@ type CSSStyleDeclaration struct { } func JSValueToCSSStyleDeclaration(val js.Value) CSSStyleDeclaration { - return CSSStyleDeclaration{Value: Value{Value: val}} + return CSSStyleDeclaration{Value: JSValueToValue(val)} } func (v Value) AsCSSStyleDeclaration() CSSStyleDeclaration { return CSSStyleDeclaration{Value: v} } +func NewCSSStyleDeclaration(args ...interface{}) CSSStyleDeclaration { + return CSSStyleDeclaration{Value: JSValueToValue(js.Global().Get("CSSStyleDeclaration").New(args...))} +} func (c CSSStyleDeclaration) GetCamel_cased_attribute() string { val := c.Get("camel_cased_attribute") return val.String() diff --git a/cssstylerule.go b/cssstylerule.go index 12a5aeb..b184652 100644 --- a/cssstylerule.go +++ b/cssstylerule.go @@ -19,8 +19,11 @@ type CSSStyleRule struct { CSSRule } -func JSValueToCSSStyleRule(val js.Value) CSSStyleRule { return CSSStyleRule{Value: Value{Value: val}} } +func JSValueToCSSStyleRule(val js.Value) CSSStyleRule { return CSSStyleRule{Value: JSValueToValue(val)} } func (v Value) AsCSSStyleRule() CSSStyleRule { return CSSStyleRule{Value: v} } +func NewCSSStyleRule(args ...interface{}) CSSStyleRule { + return CSSStyleRule{Value: JSValueToValue(js.Global().Get("CSSStyleRule").New(args...))} +} func (c CSSStyleRule) GetSelectorText() string { val := c.Get("selectorText") return val.String() diff --git a/cssstylesheet.go b/cssstylesheet.go index c6b94ca..6540dcd 100644 --- a/cssstylesheet.go +++ b/cssstylesheet.go @@ -24,9 +24,12 @@ type CSSStyleSheet struct { } func JSValueToCSSStyleSheet(val js.Value) CSSStyleSheet { - return CSSStyleSheet{Value: Value{Value: val}} + return CSSStyleSheet{Value: JSValueToValue(val)} } func (v Value) AsCSSStyleSheet() CSSStyleSheet { return CSSStyleSheet{Value: v} } +func NewCSSStyleSheet(args ...interface{}) CSSStyleSheet { + return CSSStyleSheet{Value: JSValueToValue(js.Global().Get("CSSStyleSheet").New(args...))} +} func (c CSSStyleSheet) GetCssRules() CSSRuleList { val := c.Get("cssRules") return JSValueToCSSRuleList(val.JSValue()) diff --git a/customelementregistry.go b/customelementregistry.go index a3c0494..469cab6 100644 --- a/customelementregistry.go +++ b/customelementregistry.go @@ -15,9 +15,12 @@ type CustomElementRegistry struct { } func JSValueToCustomElementRegistry(val js.Value) CustomElementRegistry { - return CustomElementRegistry{Value: Value{Value: val}} + return CustomElementRegistry{Value: JSValueToValue(val)} } func (v Value) AsCustomElementRegistry() CustomElementRegistry { return CustomElementRegistry{Value: v} } +func NewCustomElementRegistry(args ...interface{}) CustomElementRegistry { + return CustomElementRegistry{Value: JSValueToValue(js.Global().Get("CustomElementRegistry").New(args...))} +} func (c CustomElementRegistry) Define(args ...interface{}) { c.Call("define", args...) } diff --git a/customevent.go b/customevent.go index aceabed..4629215 100644 --- a/customevent.go +++ b/customevent.go @@ -33,8 +33,11 @@ type CustomEvent struct { Event } -func JSValueToCustomEvent(val js.Value) CustomEvent { return CustomEvent{Value: Value{Value: val}} } +func JSValueToCustomEvent(val js.Value) CustomEvent { return CustomEvent{Value: JSValueToValue(val)} } func (v Value) AsCustomEvent() CustomEvent { return CustomEvent{Value: v} } +func NewCustomEvent(args ...interface{}) CustomEvent { + return CustomEvent{Value: JSValueToValue(js.Global().Get("CustomEvent").New(args...))} +} func (c CustomEvent) GetDetail() Value { val := c.Get("detail") return val diff --git a/datatransfer.go b/datatransfer.go index 378a664..6290555 100644 --- a/datatransfer.go +++ b/datatransfer.go @@ -21,8 +21,11 @@ type DataTransfer struct { Value } -func JSValueToDataTransfer(val js.Value) DataTransfer { return DataTransfer{Value: Value{Value: val}} } +func JSValueToDataTransfer(val js.Value) DataTransfer { return DataTransfer{Value: JSValueToValue(val)} } func (v Value) AsDataTransfer() DataTransfer { return DataTransfer{Value: v} } +func NewDataTransfer(args ...interface{}) DataTransfer { + return DataTransfer{Value: JSValueToValue(js.Global().Get("DataTransfer").New(args...))} +} func (d DataTransfer) ClearData(args ...interface{}) { d.Call("clearData", args...) } diff --git a/datatransferitem.go b/datatransferitem.go index 8dbb3ba..e7f510b 100644 --- a/datatransferitem.go +++ b/datatransferitem.go @@ -15,9 +15,12 @@ type DataTransferItem struct { } func JSValueToDataTransferItem(val js.Value) DataTransferItem { - return DataTransferItem{Value: Value{Value: val}} + return DataTransferItem{Value: JSValueToValue(val)} } func (v Value) AsDataTransferItem() DataTransferItem { return DataTransferItem{Value: v} } +func NewDataTransferItem(args ...interface{}) DataTransferItem { + return DataTransferItem{Value: JSValueToValue(js.Global().Get("DataTransferItem").New(args...))} +} func (d DataTransferItem) GetAsFile(args ...interface{}) File { val := d.Call("getAsFile", args...) return JSValueToFile(val.JSValue()) diff --git a/datatransferitemlist.go b/datatransferitemlist.go index 86f7aba..8e6aa83 100644 --- a/datatransferitemlist.go +++ b/datatransferitemlist.go @@ -16,9 +16,12 @@ type DataTransferItemList struct { } func JSValueToDataTransferItemList(val js.Value) DataTransferItemList { - return DataTransferItemList{Value: Value{Value: val}} + return DataTransferItemList{Value: JSValueToValue(val)} } func (v Value) AsDataTransferItemList() DataTransferItemList { return DataTransferItemList{Value: v} } +func NewDataTransferItemList(args ...interface{}) DataTransferItemList { + return DataTransferItemList{Value: JSValueToValue(js.Global().Get("DataTransferItemList").New(args...))} +} func (d DataTransferItemList) Add(args ...interface{}) DataTransferItem { val := d.Call("add", args...) return JSValueToDataTransferItem(val.JSValue()) diff --git a/dedicatedworkerglobalscope.go b/dedicatedworkerglobalscope.go index c696640..f8deec3 100644 --- a/dedicatedworkerglobalscope.go +++ b/dedicatedworkerglobalscope.go @@ -41,11 +41,14 @@ type DedicatedWorkerGlobalScope struct { } func JSValueToDedicatedWorkerGlobalScope(val js.Value) DedicatedWorkerGlobalScope { - return DedicatedWorkerGlobalScope{Value: Value{Value: val}} + return DedicatedWorkerGlobalScope{Value: JSValueToValue(val)} } func (v Value) AsDedicatedWorkerGlobalScope() DedicatedWorkerGlobalScope { return DedicatedWorkerGlobalScope{Value: v} } +func NewDedicatedWorkerGlobalScope(args ...interface{}) DedicatedWorkerGlobalScope { + return DedicatedWorkerGlobalScope{Value: JSValueToValue(js.Global().Get("DedicatedWorkerGlobalScope").New(args...))} +} func (d DedicatedWorkerGlobalScope) CancelAnimationFrame(args ...interface{}) { d.Call("cancelAnimationFrame", args...) } diff --git a/document.go b/document.go index 7c3bbb6..96fbec4 100644 --- a/document.go +++ b/document.go @@ -272,8 +272,11 @@ type Document struct { EventTarget } -func JSValueToDocument(val js.Value) Document { return Document{Value: Value{Value: val}} } +func JSValueToDocument(val js.Value) Document { return Document{Value: JSValueToValue(val)} } func (v Value) AsDocument() Document { return Document{Value: v} } +func NewDocument(args ...interface{}) Document { + return Document{Value: JSValueToValue(js.Global().Get("Document").New(args...))} +} func (d Document) GetActiveElement() Element { val := d.Get("activeElement") return JSValueToElement(val.JSValue()) diff --git a/documentfragment.go b/documentfragment.go index 9bd7dfa..7e2cbc4 100644 --- a/documentfragment.go +++ b/documentfragment.go @@ -56,9 +56,12 @@ type DocumentFragment struct { } func JSValueToDocumentFragment(val js.Value) DocumentFragment { - return DocumentFragment{Value: Value{Value: val}} + return DocumentFragment{Value: JSValueToValue(val)} } func (v Value) AsDocumentFragment() DocumentFragment { return DocumentFragment{Value: v} } +func NewDocumentFragment(args ...interface{}) DocumentFragment { + return DocumentFragment{Value: JSValueToValue(js.Global().Get("DocumentFragment").New(args...))} +} func (d DocumentFragment) Append(args ...interface{}) { d.Call("append", args...) } diff --git a/documenttype.go b/documenttype.go index 69397c7..4c2054b 100644 --- a/documenttype.go +++ b/documenttype.go @@ -53,8 +53,11 @@ type DocumentType struct { EventTarget } -func JSValueToDocumentType(val js.Value) DocumentType { return DocumentType{Value: Value{Value: val}} } +func JSValueToDocumentType(val js.Value) DocumentType { return DocumentType{Value: JSValueToValue(val)} } func (v Value) AsDocumentType() DocumentType { return DocumentType{Value: v} } +func NewDocumentType(args ...interface{}) DocumentType { + return DocumentType{Value: JSValueToValue(js.Global().Get("DocumentType").New(args...))} +} func (d DocumentType) After(args ...interface{}) { d.Call("after", args...) } diff --git a/domexception.go b/domexception.go index 9542b94..55ab161 100644 --- a/domexception.go +++ b/domexception.go @@ -13,8 +13,11 @@ type DOMException struct { Value } -func JSValueToDOMException(val js.Value) DOMException { return DOMException{Value: Value{Value: val}} } +func JSValueToDOMException(val js.Value) DOMException { return DOMException{Value: JSValueToValue(val)} } func (v Value) AsDOMException() DOMException { return DOMException{Value: v} } +func NewDOMException(args ...interface{}) DOMException { + return DOMException{Value: JSValueToValue(js.Global().Get("DOMException").New(args...))} +} func (d DOMException) GetCode() int { val := d.Get("code") return val.Int() diff --git a/domimplementation.go b/domimplementation.go index 11e3f1b..1b5ee1b 100644 --- a/domimplementation.go +++ b/domimplementation.go @@ -15,9 +15,12 @@ type DOMImplementation struct { } func JSValueToDOMImplementation(val js.Value) DOMImplementation { - return DOMImplementation{Value: Value{Value: val}} + return DOMImplementation{Value: JSValueToValue(val)} } func (v Value) AsDOMImplementation() DOMImplementation { return DOMImplementation{Value: v} } +func NewDOMImplementation(args ...interface{}) DOMImplementation { + return DOMImplementation{Value: JSValueToValue(js.Global().Get("DOMImplementation").New(args...))} +} func (d DOMImplementation) CreateDocument(args ...interface{}) XMLDocument { val := d.Call("createDocument", args...) return JSValueToXMLDocument(val.JSValue()) diff --git a/dommatrix.go b/dommatrix.go index 542d0cc..4d96eb3 100644 --- a/dommatrix.go +++ b/dommatrix.go @@ -88,8 +88,11 @@ type DOMMatrix struct { DOMMatrixReadOnly } -func JSValueToDOMMatrix(val js.Value) DOMMatrix { return DOMMatrix{Value: Value{Value: val}} } +func JSValueToDOMMatrix(val js.Value) DOMMatrix { return DOMMatrix{Value: JSValueToValue(val)} } func (v Value) AsDOMMatrix() DOMMatrix { return DOMMatrix{Value: v} } +func NewDOMMatrix(args ...interface{}) DOMMatrix { + return DOMMatrix{Value: JSValueToValue(js.Global().Get("DOMMatrix").New(args...))} +} func (d DOMMatrix) GetA() float64 { val := d.Get("a") return val.Float() diff --git a/dommatrixreadonly.go b/dommatrixreadonly.go index aecd9a2..6cc6be1 100644 --- a/dommatrixreadonly.go +++ b/dommatrixreadonly.go @@ -54,9 +54,12 @@ type DOMMatrixReadOnly struct { } func JSValueToDOMMatrixReadOnly(val js.Value) DOMMatrixReadOnly { - return DOMMatrixReadOnly{Value: Value{Value: val}} + return DOMMatrixReadOnly{Value: JSValueToValue(val)} } func (v Value) AsDOMMatrixReadOnly() DOMMatrixReadOnly { return DOMMatrixReadOnly{Value: v} } +func NewDOMMatrixReadOnly(args ...interface{}) DOMMatrixReadOnly { + return DOMMatrixReadOnly{Value: JSValueToValue(js.Global().Get("DOMMatrixReadOnly").New(args...))} +} func (d DOMMatrixReadOnly) GetA() float64 { val := d.Get("a") return val.Float() diff --git a/domparser.go b/domparser.go index f835396..299baa1 100644 --- a/domparser.go +++ b/domparser.go @@ -11,8 +11,11 @@ type DOMParser struct { Value } -func JSValueToDOMParser(val js.Value) DOMParser { return DOMParser{Value: Value{Value: val}} } +func JSValueToDOMParser(val js.Value) DOMParser { return DOMParser{Value: JSValueToValue(val)} } func (v Value) AsDOMParser() DOMParser { return DOMParser{Value: v} } +func NewDOMParser(args ...interface{}) DOMParser { + return DOMParser{Value: JSValueToValue(js.Global().Get("DOMParser").New(args...))} +} func (d DOMParser) ParseFromString(args ...interface{}) Document { val := d.Call("parseFromString", args...) return JSValueToDocument(val.JSValue()) diff --git a/dompoint.go b/dompoint.go index 6b11e19..9f54dfc 100644 --- a/dompoint.go +++ b/dompoint.go @@ -22,8 +22,11 @@ type DOMPoint struct { DOMPointReadOnly } -func JSValueToDOMPoint(val js.Value) DOMPoint { return DOMPoint{Value: Value{Value: val}} } +func JSValueToDOMPoint(val js.Value) DOMPoint { return DOMPoint{Value: JSValueToValue(val)} } func (v Value) AsDOMPoint() DOMPoint { return DOMPoint{Value: v} } +func NewDOMPoint(args ...interface{}) DOMPoint { + return DOMPoint{Value: JSValueToValue(js.Global().Get("DOMPoint").New(args...))} +} func (d DOMPoint) FromPoint(args ...interface{}) DOMPoint { val := d.Call("fromPoint", args...) return JSValueToDOMPoint(val.JSValue()) diff --git a/dompointreadonly.go b/dompointreadonly.go index b4fae08..a03f3d0 100644 --- a/dompointreadonly.go +++ b/dompointreadonly.go @@ -18,9 +18,12 @@ type DOMPointReadOnly struct { } func JSValueToDOMPointReadOnly(val js.Value) DOMPointReadOnly { - return DOMPointReadOnly{Value: Value{Value: val}} + return DOMPointReadOnly{Value: JSValueToValue(val)} } func (v Value) AsDOMPointReadOnly() DOMPointReadOnly { return DOMPointReadOnly{Value: v} } +func NewDOMPointReadOnly(args ...interface{}) DOMPointReadOnly { + return DOMPointReadOnly{Value: JSValueToValue(js.Global().Get("DOMPointReadOnly").New(args...))} +} func (d DOMPointReadOnly) FromPoint(args ...interface{}) DOMPointReadOnly { val := d.Call("fromPoint", args...) return JSValueToDOMPointReadOnly(val.JSValue()) diff --git a/domquad.go b/domquad.go index 97b96d3..f242f3f 100644 --- a/domquad.go +++ b/domquad.go @@ -18,8 +18,11 @@ type DOMQuad struct { Value } -func JSValueToDOMQuad(val js.Value) DOMQuad { return DOMQuad{Value: Value{Value: val}} } +func JSValueToDOMQuad(val js.Value) DOMQuad { return DOMQuad{Value: JSValueToValue(val)} } func (v Value) AsDOMQuad() DOMQuad { return DOMQuad{Value: v} } +func NewDOMQuad(args ...interface{}) DOMQuad { + return DOMQuad{Value: JSValueToValue(js.Global().Get("DOMQuad").New(args...))} +} func (d DOMQuad) FromQuad(args ...interface{}) DOMQuad { val := d.Call("fromQuad", args...) return JSValueToDOMQuad(val.JSValue()) diff --git a/domrect.go b/domrect.go index f5c3afd..36b04c4 100644 --- a/domrect.go +++ b/domrect.go @@ -25,8 +25,11 @@ type DOMRect struct { DOMRectReadOnly } -func JSValueToDOMRect(val js.Value) DOMRect { return DOMRect{Value: Value{Value: val}} } +func JSValueToDOMRect(val js.Value) DOMRect { return DOMRect{Value: JSValueToValue(val)} } func (v Value) AsDOMRect() DOMRect { return DOMRect{Value: v} } +func NewDOMRect(args ...interface{}) DOMRect { + return DOMRect{Value: JSValueToValue(js.Global().Get("DOMRect").New(args...))} +} func (d DOMRect) FromRect(args ...interface{}) DOMRect { val := d.Call("fromRect", args...) return JSValueToDOMRect(val.JSValue()) diff --git a/domrectlist.go b/domrectlist.go index ad39da5..3f2a5bb 100644 --- a/domrectlist.go +++ b/domrectlist.go @@ -12,8 +12,11 @@ type DOMRectList struct { Value } -func JSValueToDOMRectList(val js.Value) DOMRectList { return DOMRectList{Value: Value{Value: val}} } +func JSValueToDOMRectList(val js.Value) DOMRectList { return DOMRectList{Value: JSValueToValue(val)} } func (v Value) AsDOMRectList() DOMRectList { return DOMRectList{Value: v} } +func NewDOMRectList(args ...interface{}) DOMRectList { + return DOMRectList{Value: JSValueToValue(js.Global().Get("DOMRectList").New(args...))} +} func (d DOMRectList) Item(args ...interface{}) DOMRect { val := d.Call("item", args...) return JSValueToDOMRect(val.JSValue()) diff --git a/domrectreadonly.go b/domrectreadonly.go index e0e1575..94d9e96 100644 --- a/domrectreadonly.go +++ b/domrectreadonly.go @@ -21,9 +21,12 @@ type DOMRectReadOnly struct { } func JSValueToDOMRectReadOnly(val js.Value) DOMRectReadOnly { - return DOMRectReadOnly{Value: Value{Value: val}} + return DOMRectReadOnly{Value: JSValueToValue(val)} } func (v Value) AsDOMRectReadOnly() DOMRectReadOnly { return DOMRectReadOnly{Value: v} } +func NewDOMRectReadOnly(args ...interface{}) DOMRectReadOnly { + return DOMRectReadOnly{Value: JSValueToValue(js.Global().Get("DOMRectReadOnly").New(args...))} +} func (d DOMRectReadOnly) GetBottom() float64 { val := d.Get("bottom") return val.Float() diff --git a/domstringlist.go b/domstringlist.go index 8180f91..60e2f62 100644 --- a/domstringlist.go +++ b/domstringlist.go @@ -14,9 +14,12 @@ type DOMStringList struct { } func JSValueToDOMStringList(val js.Value) DOMStringList { - return DOMStringList{Value: Value{Value: val}} + return DOMStringList{Value: JSValueToValue(val)} } func (v Value) AsDOMStringList() DOMStringList { return DOMStringList{Value: v} } +func NewDOMStringList(args ...interface{}) DOMStringList { + return DOMStringList{Value: JSValueToValue(js.Global().Get("DOMStringList").New(args...))} +} func (d DOMStringList) Contains(args ...interface{}) bool { val := d.Call("contains", args...) return val.Bool() diff --git a/domstringmap.go b/domstringmap.go index d0681bd..fa83db2 100644 --- a/domstringmap.go +++ b/domstringmap.go @@ -10,5 +10,8 @@ type DOMStringMap struct { Value } -func JSValueToDOMStringMap(val js.Value) DOMStringMap { return DOMStringMap{Value: Value{Value: val}} } +func JSValueToDOMStringMap(val js.Value) DOMStringMap { return DOMStringMap{Value: JSValueToValue(val)} } func (v Value) AsDOMStringMap() DOMStringMap { return DOMStringMap{Value: v} } +func NewDOMStringMap(args ...interface{}) DOMStringMap { + return DOMStringMap{Value: JSValueToValue(js.Global().Get("DOMStringMap").New(args...))} +} diff --git a/domtokenlist.go b/domtokenlist.go index b5b7383..fd0555b 100644 --- a/domtokenlist.go +++ b/domtokenlist.go @@ -20,8 +20,11 @@ type DOMTokenList struct { Value } -func JSValueToDOMTokenList(val js.Value) DOMTokenList { return DOMTokenList{Value: Value{Value: val}} } +func JSValueToDOMTokenList(val js.Value) DOMTokenList { return DOMTokenList{Value: JSValueToValue(val)} } func (v Value) AsDOMTokenList() DOMTokenList { return DOMTokenList{Value: v} } +func NewDOMTokenList(args ...interface{}) DOMTokenList { + return DOMTokenList{Value: JSValueToValue(js.Global().Get("DOMTokenList").New(args...))} +} func (d DOMTokenList) Add(args ...interface{}) { d.Call("add", args...) } diff --git a/dragevent.go b/dragevent.go index 43c1755..d6f314f 100644 --- a/dragevent.go +++ b/dragevent.go @@ -11,8 +11,11 @@ type DragEvent struct { Value } -func JSValueToDragEvent(val js.Value) DragEvent { return DragEvent{Value: Value{Value: val}} } +func JSValueToDragEvent(val js.Value) DragEvent { return DragEvent{Value: JSValueToValue(val)} } func (v Value) AsDragEvent() DragEvent { return DragEvent{Value: v} } +func NewDragEvent(args ...interface{}) DragEvent { + return DragEvent{Value: JSValueToValue(js.Global().Get("DragEvent").New(args...))} +} func (d DragEvent) GetDataTransfer() DataTransfer { val := d.Get("dataTransfer") return JSValueToDataTransfer(val.JSValue()) diff --git a/element.go b/element.go index 11f0e90..5a11cab 100644 --- a/element.go +++ b/element.go @@ -104,8 +104,11 @@ type Element struct { EventTarget } -func JSValueToElement(val js.Value) Element { return Element{Value: Value{Value: val}} } +func JSValueToElement(val js.Value) Element { return Element{Value: JSValueToValue(val)} } func (v Value) AsElement() Element { return Element{Value: v} } +func NewElement(args ...interface{}) Element { + return Element{Value: JSValueToValue(js.Global().Get("Element").New(args...))} +} func (e Element) After(args ...interface{}) { e.Call("after", args...) } diff --git a/errorevent.go b/errorevent.go index d0de736..ba62906 100644 --- a/errorevent.go +++ b/errorevent.go @@ -36,8 +36,11 @@ type ErrorEvent struct { Event } -func JSValueToErrorEvent(val js.Value) ErrorEvent { return ErrorEvent{Value: Value{Value: val}} } +func JSValueToErrorEvent(val js.Value) ErrorEvent { return ErrorEvent{Value: JSValueToValue(val)} } func (v Value) AsErrorEvent() ErrorEvent { return ErrorEvent{Value: v} } +func NewErrorEvent(args ...interface{}) ErrorEvent { + return ErrorEvent{Value: JSValueToValue(js.Global().Get("ErrorEvent").New(args...))} +} func (e ErrorEvent) GetColno() int { val := e.Get("colno") return val.Int() diff --git a/event.go b/event.go index 4be6dbd..c53c76d 100644 --- a/event.go +++ b/event.go @@ -30,8 +30,11 @@ type Event struct { Value } -func JSValueToEvent(val js.Value) Event { return Event{Value: Value{Value: val}} } +func JSValueToEvent(val js.Value) Event { return Event{Value: JSValueToValue(val)} } func (v Value) AsEvent() Event { return Event{Value: v} } +func NewEvent(args ...interface{}) Event { + return Event{Value: JSValueToValue(js.Global().Get("Event").New(args...))} +} func (e Event) GetBubbles() bool { val := e.Get("bubbles") return val.Bool() diff --git a/eventsource.go b/eventsource.go index eaacbea..37caa1b 100644 --- a/eventsource.go +++ b/eventsource.go @@ -24,8 +24,11 @@ type EventSource struct { EventTarget } -func JSValueToEventSource(val js.Value) EventSource { return EventSource{Value: Value{Value: val}} } +func JSValueToEventSource(val js.Value) EventSource { return EventSource{Value: JSValueToValue(val)} } func (v Value) AsEventSource() EventSource { return EventSource{Value: v} } +func NewEventSource(args ...interface{}) EventSource { + return EventSource{Value: JSValueToValue(js.Global().Get("EventSource").New(args...))} +} func (e EventSource) Close(args ...interface{}) { e.Call("close", args...) } diff --git a/eventtarget.go b/eventtarget.go index bc2b670..249a1c4 100644 --- a/eventtarget.go +++ b/eventtarget.go @@ -13,8 +13,11 @@ type EventTarget struct { Value } -func JSValueToEventTarget(val js.Value) EventTarget { return EventTarget{Value: Value{Value: val}} } +func JSValueToEventTarget(val js.Value) EventTarget { return EventTarget{Value: JSValueToValue(val)} } func (v Value) AsEventTarget() EventTarget { return EventTarget{Value: v} } +func NewEventTarget(args ...interface{}) EventTarget { + return EventTarget{Value: JSValueToValue(js.Global().Get("EventTarget").New(args...))} +} func (e EventTarget) AddEventListener(args ...interface{}) { e.Call("addEventListener", args...) } diff --git a/example.go b/example.go index 082369b..ac292fb 100644 --- a/example.go +++ b/example.go @@ -10,5 +10,8 @@ type Example struct { Value } -func JSValueToExample(val js.Value) Example { return Example{Value: Value{Value: val}} } +func JSValueToExample(val js.Value) Example { return Example{Value: JSValueToValue(val)} } func (v Value) AsExample() Example { return Example{Value: v} } +func NewExample(args ...interface{}) Example { + return Example{Value: JSValueToValue(js.Global().Get("Example").New(args...))} +} diff --git a/external.go b/external.go index 1e1bac1..d41fc67 100644 --- a/external.go +++ b/external.go @@ -12,8 +12,11 @@ type External struct { Value } -func JSValueToExternal(val js.Value) External { return External{Value: Value{Value: val}} } +func JSValueToExternal(val js.Value) External { return External{Value: JSValueToValue(val)} } func (v Value) AsExternal() External { return External{Value: v} } +func NewExternal(args ...interface{}) External { + return External{Value: JSValueToValue(js.Global().Get("External").New(args...))} +} func (e External) AddSearchProvider(args ...interface{}) { e.Call("AddSearchProvider", args...) } diff --git a/file.go b/file.go index f293167..0bf15cb 100644 --- a/file.go +++ b/file.go @@ -16,8 +16,11 @@ type File struct { Blob } -func JSValueToFile(val js.Value) File { return File{Value: Value{Value: val}} } +func JSValueToFile(val js.Value) File { return File{Value: JSValueToValue(val)} } func (v Value) AsFile() File { return File{Value: v} } +func NewFile(args ...interface{}) File { + return File{Value: JSValueToValue(js.Global().Get("File").New(args...))} +} func (f File) GetLastModified() int { val := f.Get("lastModified") return val.Int() diff --git a/filelist.go b/filelist.go index 3da3083..d8e9bb4 100644 --- a/filelist.go +++ b/filelist.go @@ -12,8 +12,11 @@ type FileList struct { Value } -func JSValueToFileList(val js.Value) FileList { return FileList{Value: Value{Value: val}} } +func JSValueToFileList(val js.Value) FileList { return FileList{Value: JSValueToValue(val)} } func (v Value) AsFileList() FileList { return FileList{Value: v} } +func NewFileList(args ...interface{}) FileList { + return FileList{Value: JSValueToValue(js.Global().Get("FileList").New(args...))} +} func (f FileList) Item(args ...interface{}) File { val := f.Call("item", args...) return JSValueToFile(val.JSValue()) diff --git a/filereader.go b/filereader.go index d1215d5..af31b5e 100644 --- a/filereader.go +++ b/filereader.go @@ -34,8 +34,11 @@ type FileReader struct { EventTarget } -func JSValueToFileReader(val js.Value) FileReader { return FileReader{Value: Value{Value: val}} } +func JSValueToFileReader(val js.Value) FileReader { return FileReader{Value: JSValueToValue(val)} } func (v Value) AsFileReader() FileReader { return FileReader{Value: v} } +func NewFileReader(args ...interface{}) FileReader { + return FileReader{Value: JSValueToValue(js.Global().Get("FileReader").New(args...))} +} func (f FileReader) Abort(args ...interface{}) { f.Call("abort", args...) } diff --git a/filereadersync.go b/filereadersync.go index 9017f20..ed52795 100644 --- a/filereadersync.go +++ b/filereadersync.go @@ -15,9 +15,12 @@ type FileReaderSync struct { } func JSValueToFileReaderSync(val js.Value) FileReaderSync { - return FileReaderSync{Value: Value{Value: val}} + return FileReaderSync{Value: JSValueToValue(val)} } func (v Value) AsFileReaderSync() FileReaderSync { return FileReaderSync{Value: v} } +func NewFileReaderSync(args ...interface{}) FileReaderSync { + return FileReaderSync{Value: JSValueToValue(js.Global().Get("FileReaderSync").New(args...))} +} func (f FileReaderSync) ReadAsArrayBuffer(args ...interface{}) ArrayBuffer { val := f.Call("readAsArrayBuffer", args...) return JSValueToArrayBuffer(val.JSValue()) diff --git a/formdata.go b/formdata.go index 7d221b1..7d8bb73 100644 --- a/formdata.go +++ b/formdata.go @@ -18,8 +18,11 @@ type FormData struct { Value } -func JSValueToFormData(val js.Value) FormData { return FormData{Value: Value{Value: val}} } +func JSValueToFormData(val js.Value) FormData { return FormData{Value: JSValueToValue(val)} } func (v Value) AsFormData() FormData { return FormData{Value: v} } +func NewFormData(args ...interface{}) FormData { + return FormData{Value: JSValueToValue(js.Global().Get("FormData").New(args...))} +} func (f FormData) Append(args ...interface{}) { f.Call("append", args...) } diff --git a/generate/generator.go b/generate/generator.go index a5bc25c..2f5aa07 100644 --- a/generate/generator.go +++ b/generate/generator.go @@ -167,8 +167,9 @@ func (g *Generator) generateInterface(spec Spec) error { b.WriteString("}") - b.WriteF("func JSValueTo%s(val js.Value) %s { return %s{ Value: Value { Value: val }}}", spec.Name, spec.Name, spec.Name) + b.WriteF("func JSValueTo%s(val js.Value) %s { return %s{ Value: JSValueToValue(val) } }", spec.Name, spec.Name, spec.Name) b.WriteF("func (v Value) As%s() %s { return %s{Value: v} }", spec.Name, spec.Name, spec.Name) + b.WriteF("func New%s(args ...interface{}) %s { return %s{ Value: JSValueToValue(js.Global().Get(\"%s\").New(args...)) } }", spec.Name, spec.Name, spec.Name, spec.Name) mems, err = spec.ResolveMembers(g.specs, false) if err != nil { diff --git a/hashchangeevent.go b/hashchangeevent.go index 0699a10..166054c 100644 --- a/hashchangeevent.go +++ b/hashchangeevent.go @@ -34,9 +34,12 @@ type HashChangeEvent struct { } func JSValueToHashChangeEvent(val js.Value) HashChangeEvent { - return HashChangeEvent{Value: Value{Value: val}} + return HashChangeEvent{Value: JSValueToValue(val)} } func (v Value) AsHashChangeEvent() HashChangeEvent { return HashChangeEvent{Value: v} } +func NewHashChangeEvent(args ...interface{}) HashChangeEvent { + return HashChangeEvent{Value: JSValueToValue(js.Global().Get("HashChangeEvent").New(args...))} +} func (h HashChangeEvent) GetNewURL() string { val := h.Get("newURL") return val.String() diff --git a/headers.go b/headers.go index da4fe6b..648644d 100644 --- a/headers.go +++ b/headers.go @@ -15,8 +15,11 @@ type Headers struct { Value } -func JSValueToHeaders(val js.Value) Headers { return Headers{Value: Value{Value: val}} } +func JSValueToHeaders(val js.Value) Headers { return Headers{Value: JSValueToValue(val)} } func (v Value) AsHeaders() Headers { return Headers{Value: v} } +func NewHeaders(args ...interface{}) Headers { + return Headers{Value: JSValueToValue(js.Global().Get("Headers").New(args...))} +} func (h Headers) Append(args ...interface{}) { h.Call("append", args...) } diff --git a/history.go b/history.go index c7f9dbc..f509798 100644 --- a/history.go +++ b/history.go @@ -19,8 +19,11 @@ type History struct { Value } -func JSValueToHistory(val js.Value) History { return History{Value: Value{Value: val}} } +func JSValueToHistory(val js.Value) History { return History{Value: JSValueToValue(val)} } func (v Value) AsHistory() History { return History{Value: v} } +func NewHistory(args ...interface{}) History { + return History{Value: JSValueToValue(js.Global().Get("History").New(args...))} +} func (h History) Back(args ...interface{}) { h.Call("back", args...) } diff --git a/htmlallcollection.go b/htmlallcollection.go index d4fd413..71c9f64 100644 --- a/htmlallcollection.go +++ b/htmlallcollection.go @@ -14,9 +14,12 @@ type HTMLAllCollection struct { } func JSValueToHTMLAllCollection(val js.Value) HTMLAllCollection { - return HTMLAllCollection{Value: Value{Value: val}} + return HTMLAllCollection{Value: JSValueToValue(val)} } func (v Value) AsHTMLAllCollection() HTMLAllCollection { return HTMLAllCollection{Value: v} } +func NewHTMLAllCollection(args ...interface{}) HTMLAllCollection { + return HTMLAllCollection{Value: JSValueToValue(js.Global().Get("HTMLAllCollection").New(args...))} +} func (h HTMLAllCollection) Item(args ...interface{}) { h.Call("item", args...) } diff --git a/htmlanchorelement.go b/htmlanchorelement.go index 2fd0f0a..bd6e38c 100644 --- a/htmlanchorelement.go +++ b/htmlanchorelement.go @@ -157,9 +157,12 @@ type HTMLAnchorElement struct { } func JSValueToHTMLAnchorElement(val js.Value) HTMLAnchorElement { - return HTMLAnchorElement{Value: Value{Value: val}} + return HTMLAnchorElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLAnchorElement() HTMLAnchorElement { return HTMLAnchorElement{Value: v} } +func NewHTMLAnchorElement(args ...interface{}) HTMLAnchorElement { + return HTMLAnchorElement{Value: JSValueToValue(js.Global().Get("HTMLAnchorElement").New(args...))} +} func (h HTMLAnchorElement) GetCharset() string { val := h.Get("charset") return val.String() diff --git a/htmlareaelement.go b/htmlareaelement.go index 18aae73..e75dc49 100644 --- a/htmlareaelement.go +++ b/htmlareaelement.go @@ -149,9 +149,12 @@ type HTMLAreaElement struct { } func JSValueToHTMLAreaElement(val js.Value) HTMLAreaElement { - return HTMLAreaElement{Value: Value{Value: val}} + return HTMLAreaElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLAreaElement() HTMLAreaElement { return HTMLAreaElement{Value: v} } +func NewHTMLAreaElement(args ...interface{}) HTMLAreaElement { + return HTMLAreaElement{Value: JSValueToValue(js.Global().Get("HTMLAreaElement").New(args...))} +} func (h HTMLAreaElement) GetAlt() string { val := h.Get("alt") return val.String() diff --git a/htmlaudioelement.go b/htmlaudioelement.go index 7c07750..e0c9e65 100644 --- a/htmlaudioelement.go +++ b/htmlaudioelement.go @@ -157,6 +157,9 @@ type HTMLAudioElement struct { } func JSValueToHTMLAudioElement(val js.Value) HTMLAudioElement { - return HTMLAudioElement{Value: Value{Value: val}} + return HTMLAudioElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLAudioElement() HTMLAudioElement { return HTMLAudioElement{Value: v} } +func NewHTMLAudioElement(args ...interface{}) HTMLAudioElement { + return HTMLAudioElement{Value: JSValueToValue(js.Global().Get("HTMLAudioElement").New(args...))} +} diff --git a/htmlbaseelement.go b/htmlbaseelement.go index 6299883..0605574 100644 --- a/htmlbaseelement.go +++ b/htmlbaseelement.go @@ -113,9 +113,12 @@ type HTMLBaseElement struct { } func JSValueToHTMLBaseElement(val js.Value) HTMLBaseElement { - return HTMLBaseElement{Value: Value{Value: val}} + return HTMLBaseElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLBaseElement() HTMLBaseElement { return HTMLBaseElement{Value: v} } +func NewHTMLBaseElement(args ...interface{}) HTMLBaseElement { + return HTMLBaseElement{Value: JSValueToValue(js.Global().Get("HTMLBaseElement").New(args...))} +} func (h HTMLBaseElement) GetHref() string { val := h.Get("href") return val.String() diff --git a/htmlbodyelement.go b/htmlbodyelement.go index a946640..8ec55c0 100644 --- a/htmlbodyelement.go +++ b/htmlbodyelement.go @@ -153,9 +153,12 @@ type HTMLBodyElement struct { } func JSValueToHTMLBodyElement(val js.Value) HTMLBodyElement { - return HTMLBodyElement{Value: Value{Value: val}} + return HTMLBodyElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLBodyElement() HTMLBodyElement { return HTMLBodyElement{Value: v} } +func NewHTMLBodyElement(args ...interface{}) HTMLBodyElement { + return HTMLBodyElement{Value: JSValueToValue(js.Global().Get("HTMLBodyElement").New(args...))} +} func (h HTMLBodyElement) GetALink() string { val := h.Get("aLink") return val.String() diff --git a/htmlbrelement.go b/htmlbrelement.go index a6770b9..250fcdb 100644 --- a/htmlbrelement.go +++ b/htmlbrelement.go @@ -111,9 +111,12 @@ type HTMLBRElement struct { } func JSValueToHTMLBRElement(val js.Value) HTMLBRElement { - return HTMLBRElement{Value: Value{Value: val}} + return HTMLBRElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLBRElement() HTMLBRElement { return HTMLBRElement{Value: v} } +func NewHTMLBRElement(args ...interface{}) HTMLBRElement { + return HTMLBRElement{Value: JSValueToValue(js.Global().Get("HTMLBRElement").New(args...))} +} func (h HTMLBRElement) GetClear() string { val := h.Get("clear") return val.String() diff --git a/htmlbuttonelement.go b/htmlbuttonelement.go index c4e1486..b148b07 100644 --- a/htmlbuttonelement.go +++ b/htmlbuttonelement.go @@ -137,9 +137,12 @@ type HTMLButtonElement struct { } func JSValueToHTMLButtonElement(val js.Value) HTMLButtonElement { - return HTMLButtonElement{Value: Value{Value: val}} + return HTMLButtonElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLButtonElement() HTMLButtonElement { return HTMLButtonElement{Value: v} } +func NewHTMLButtonElement(args ...interface{}) HTMLButtonElement { + return HTMLButtonElement{Value: JSValueToValue(js.Global().Get("HTMLButtonElement").New(args...))} +} func (h HTMLButtonElement) GetAutofocus() bool { val := h.Get("autofocus") return val.Bool() diff --git a/htmlcanvaselement.go b/htmlcanvaselement.go index 5f939c2..1cbe94d 100644 --- a/htmlcanvaselement.go +++ b/htmlcanvaselement.go @@ -117,9 +117,12 @@ type HTMLCanvasElement struct { } func JSValueToHTMLCanvasElement(val js.Value) HTMLCanvasElement { - return HTMLCanvasElement{Value: Value{Value: val}} + return HTMLCanvasElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLCanvasElement() HTMLCanvasElement { return HTMLCanvasElement{Value: v} } +func NewHTMLCanvasElement(args ...interface{}) HTMLCanvasElement { + return HTMLCanvasElement{Value: JSValueToValue(js.Global().Get("HTMLCanvasElement").New(args...))} +} func (h HTMLCanvasElement) GetContext(args ...interface{}) RenderingContext { val := h.Call("getContext", args...) return JSValueToRenderingContext(val.JSValue()) diff --git a/htmlcollection.go b/htmlcollection.go index cc120b5..9b75345 100644 --- a/htmlcollection.go +++ b/htmlcollection.go @@ -14,9 +14,12 @@ type HTMLCollection struct { } func JSValueToHTMLCollection(val js.Value) HTMLCollection { - return HTMLCollection{Value: Value{Value: val}} + return HTMLCollection{Value: JSValueToValue(val)} } func (v Value) AsHTMLCollection() HTMLCollection { return HTMLCollection{Value: v} } +func NewHTMLCollection(args ...interface{}) HTMLCollection { + return HTMLCollection{Value: JSValueToValue(js.Global().Get("HTMLCollection").New(args...))} +} func (h HTMLCollection) Item(args ...interface{}) Element { val := h.Call("item", args...) return JSValueToElement(val.JSValue()) diff --git a/htmldataelement.go b/htmldataelement.go index d9887c9..183dbcc 100644 --- a/htmldataelement.go +++ b/htmldataelement.go @@ -111,9 +111,12 @@ type HTMLDataElement struct { } func JSValueToHTMLDataElement(val js.Value) HTMLDataElement { - return HTMLDataElement{Value: Value{Value: val}} + return HTMLDataElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLDataElement() HTMLDataElement { return HTMLDataElement{Value: v} } +func NewHTMLDataElement(args ...interface{}) HTMLDataElement { + return HTMLDataElement{Value: JSValueToValue(js.Global().Get("HTMLDataElement").New(args...))} +} func (h HTMLDataElement) GetValue() string { val := h.Get("value") return val.String() diff --git a/htmldatalistelement.go b/htmldatalistelement.go index bc8b69b..5fa349f 100644 --- a/htmldatalistelement.go +++ b/htmldatalistelement.go @@ -110,9 +110,12 @@ type HTMLDataListElement struct { } func JSValueToHTMLDataListElement(val js.Value) HTMLDataListElement { - return HTMLDataListElement{Value: Value{Value: val}} + return HTMLDataListElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLDataListElement() HTMLDataListElement { return HTMLDataListElement{Value: v} } +func NewHTMLDataListElement(args ...interface{}) HTMLDataListElement { + return HTMLDataListElement{Value: JSValueToValue(js.Global().Get("HTMLDataListElement").New(args...))} +} func (h HTMLDataListElement) GetOptions() HTMLCollection { val := h.Get("options") return JSValueToHTMLCollection(val.JSValue()) diff --git a/htmldetailselement.go b/htmldetailselement.go index be3c785..04736f4 100644 --- a/htmldetailselement.go +++ b/htmldetailselement.go @@ -111,9 +111,12 @@ type HTMLDetailsElement struct { } func JSValueToHTMLDetailsElement(val js.Value) HTMLDetailsElement { - return HTMLDetailsElement{Value: Value{Value: val}} + return HTMLDetailsElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLDetailsElement() HTMLDetailsElement { return HTMLDetailsElement{Value: v} } +func NewHTMLDetailsElement(args ...interface{}) HTMLDetailsElement { + return HTMLDetailsElement{Value: JSValueToValue(js.Global().Get("HTMLDetailsElement").New(args...))} +} func (h HTMLDetailsElement) GetOpen() bool { val := h.Get("open") return val.Bool() diff --git a/htmldialogelement.go b/htmldialogelement.go index 1e4d223..7aa9fe5 100644 --- a/htmldialogelement.go +++ b/htmldialogelement.go @@ -116,9 +116,12 @@ type HTMLDialogElement struct { } func JSValueToHTMLDialogElement(val js.Value) HTMLDialogElement { - return HTMLDialogElement{Value: Value{Value: val}} + return HTMLDialogElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLDialogElement() HTMLDialogElement { return HTMLDialogElement{Value: v} } +func NewHTMLDialogElement(args ...interface{}) HTMLDialogElement { + return HTMLDialogElement{Value: JSValueToValue(js.Global().Get("HTMLDialogElement").New(args...))} +} func (h HTMLDialogElement) Close(args ...interface{}) { h.Call("close", args...) } diff --git a/htmldirectoryelement.go b/htmldirectoryelement.go index 8f475ba..148ef10 100644 --- a/htmldirectoryelement.go +++ b/htmldirectoryelement.go @@ -111,9 +111,12 @@ type HTMLDirectoryElement struct { } func JSValueToHTMLDirectoryElement(val js.Value) HTMLDirectoryElement { - return HTMLDirectoryElement{Value: Value{Value: val}} + return HTMLDirectoryElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLDirectoryElement() HTMLDirectoryElement { return HTMLDirectoryElement{Value: v} } +func NewHTMLDirectoryElement(args ...interface{}) HTMLDirectoryElement { + return HTMLDirectoryElement{Value: JSValueToValue(js.Global().Get("HTMLDirectoryElement").New(args...))} +} func (h HTMLDirectoryElement) GetCompact() bool { val := h.Get("compact") return val.Bool() diff --git a/htmldivelement.go b/htmldivelement.go index 5b2464c..f00932e 100644 --- a/htmldivelement.go +++ b/htmldivelement.go @@ -111,9 +111,12 @@ type HTMLDivElement struct { } func JSValueToHTMLDivElement(val js.Value) HTMLDivElement { - return HTMLDivElement{Value: Value{Value: val}} + return HTMLDivElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLDivElement() HTMLDivElement { return HTMLDivElement{Value: v} } +func NewHTMLDivElement(args ...interface{}) HTMLDivElement { + return HTMLDivElement{Value: JSValueToValue(js.Global().Get("HTMLDivElement").New(args...))} +} func (h HTMLDivElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmldlistelement.go b/htmldlistelement.go index 0dd7245..eb34b35 100644 --- a/htmldlistelement.go +++ b/htmldlistelement.go @@ -111,9 +111,12 @@ type HTMLDListElement struct { } func JSValueToHTMLDListElement(val js.Value) HTMLDListElement { - return HTMLDListElement{Value: Value{Value: val}} + return HTMLDListElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLDListElement() HTMLDListElement { return HTMLDListElement{Value: v} } +func NewHTMLDListElement(args ...interface{}) HTMLDListElement { + return HTMLDListElement{Value: JSValueToValue(js.Global().Get("HTMLDListElement").New(args...))} +} func (h HTMLDListElement) GetCompact() bool { val := h.Get("compact") return val.Bool() diff --git a/htmlelement.go b/htmlelement.go index 5bc9a10..65dd08a 100644 --- a/htmlelement.go +++ b/htmlelement.go @@ -252,8 +252,11 @@ type HTMLElement struct { EventTarget } -func JSValueToHTMLElement(val js.Value) HTMLElement { return HTMLElement{Value: Value{Value: val}} } +func JSValueToHTMLElement(val js.Value) HTMLElement { return HTMLElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLElement() HTMLElement { return HTMLElement{Value: v} } +func NewHTMLElement(args ...interface{}) HTMLElement { + return HTMLElement{Value: JSValueToValue(js.Global().Get("HTMLElement").New(args...))} +} func (h HTMLElement) GetAccessKey() string { val := h.Get("accessKey") return val.String() diff --git a/htmlembedelement.go b/htmlembedelement.go index f1b3340..73eb5ae 100644 --- a/htmlembedelement.go +++ b/htmlembedelement.go @@ -122,9 +122,12 @@ type HTMLEmbedElement struct { } func JSValueToHTMLEmbedElement(val js.Value) HTMLEmbedElement { - return HTMLEmbedElement{Value: Value{Value: val}} + return HTMLEmbedElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLEmbedElement() HTMLEmbedElement { return HTMLEmbedElement{Value: v} } +func NewHTMLEmbedElement(args ...interface{}) HTMLEmbedElement { + return HTMLEmbedElement{Value: JSValueToValue(js.Global().Get("HTMLEmbedElement").New(args...))} +} func (h HTMLEmbedElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmlfieldsetelement.go b/htmlfieldsetelement.go index d0c76a0..96470da 100644 --- a/htmlfieldsetelement.go +++ b/htmlfieldsetelement.go @@ -122,9 +122,12 @@ type HTMLFieldSetElement struct { } func JSValueToHTMLFieldSetElement(val js.Value) HTMLFieldSetElement { - return HTMLFieldSetElement{Value: Value{Value: val}} + return HTMLFieldSetElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLFieldSetElement() HTMLFieldSetElement { return HTMLFieldSetElement{Value: v} } +func NewHTMLFieldSetElement(args ...interface{}) HTMLFieldSetElement { + return HTMLFieldSetElement{Value: JSValueToValue(js.Global().Get("HTMLFieldSetElement").New(args...))} +} func (h HTMLFieldSetElement) CheckValidity(args ...interface{}) bool { val := h.Call("checkValidity", args...) return val.Bool() diff --git a/htmlfontelement.go b/htmlfontelement.go index 2f1472c..25b7e55 100644 --- a/htmlfontelement.go +++ b/htmlfontelement.go @@ -115,9 +115,12 @@ type HTMLFontElement struct { } func JSValueToHTMLFontElement(val js.Value) HTMLFontElement { - return HTMLFontElement{Value: Value{Value: val}} + return HTMLFontElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLFontElement() HTMLFontElement { return HTMLFontElement{Value: v} } +func NewHTMLFontElement(args ...interface{}) HTMLFontElement { + return HTMLFontElement{Value: JSValueToValue(js.Global().Get("HTMLFontElement").New(args...))} +} func (h HTMLFontElement) GetColor() string { val := h.Get("color") return val.String() diff --git a/htmlformcontrolscollection.go b/htmlformcontrolscollection.go index 7ef81e8..ccc74fe 100644 --- a/htmlformcontrolscollection.go +++ b/htmlformcontrolscollection.go @@ -15,11 +15,14 @@ type HTMLFormControlsCollection struct { } func JSValueToHTMLFormControlsCollection(val js.Value) HTMLFormControlsCollection { - return HTMLFormControlsCollection{Value: Value{Value: val}} + return HTMLFormControlsCollection{Value: JSValueToValue(val)} } func (v Value) AsHTMLFormControlsCollection() HTMLFormControlsCollection { return HTMLFormControlsCollection{Value: v} } +func NewHTMLFormControlsCollection(args ...interface{}) HTMLFormControlsCollection { + return HTMLFormControlsCollection{Value: JSValueToValue(js.Global().Get("HTMLFormControlsCollection").New(args...))} +} func (h HTMLFormControlsCollection) NamedItem(args ...interface{}) { h.Call("namedItem", args...) } diff --git a/htmlformelement.go b/htmlformelement.go index cad6377..10018ea 100644 --- a/htmlformelement.go +++ b/htmlformelement.go @@ -133,9 +133,12 @@ type HTMLFormElement struct { } func JSValueToHTMLFormElement(val js.Value) HTMLFormElement { - return HTMLFormElement{Value: Value{Value: val}} + return HTMLFormElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLFormElement() HTMLFormElement { return HTMLFormElement{Value: v} } +func NewHTMLFormElement(args ...interface{}) HTMLFormElement { + return HTMLFormElement{Value: JSValueToValue(js.Global().Get("HTMLFormElement").New(args...))} +} func (h HTMLFormElement) GetAcceptCharset() string { val := h.Get("acceptCharset") return val.String() diff --git a/htmlframeelement.go b/htmlframeelement.go index 483e1da..c4e9758 100644 --- a/htmlframeelement.go +++ b/htmlframeelement.go @@ -127,9 +127,12 @@ type HTMLFrameElement struct { } func JSValueToHTMLFrameElement(val js.Value) HTMLFrameElement { - return HTMLFrameElement{Value: Value{Value: val}} + return HTMLFrameElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLFrameElement() HTMLFrameElement { return HTMLFrameElement{Value: v} } +func NewHTMLFrameElement(args ...interface{}) HTMLFrameElement { + return HTMLFrameElement{Value: JSValueToValue(js.Global().Get("HTMLFrameElement").New(args...))} +} func (h HTMLFrameElement) GetContentDocument() Document { val := h.Get("contentDocument") return JSValueToDocument(val.JSValue()) diff --git a/htmlframesetelement.go b/htmlframesetelement.go index d90b47d..b6cbce9 100644 --- a/htmlframesetelement.go +++ b/htmlframesetelement.go @@ -145,9 +145,12 @@ type HTMLFrameSetElement struct { } func JSValueToHTMLFrameSetElement(val js.Value) HTMLFrameSetElement { - return HTMLFrameSetElement{Value: Value{Value: val}} + return HTMLFrameSetElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLFrameSetElement() HTMLFrameSetElement { return HTMLFrameSetElement{Value: v} } +func NewHTMLFrameSetElement(args ...interface{}) HTMLFrameSetElement { + return HTMLFrameSetElement{Value: JSValueToValue(js.Global().Get("HTMLFrameSetElement").New(args...))} +} func (h HTMLFrameSetElement) GetCols() string { val := h.Get("cols") return val.String() diff --git a/htmlheadelement.go b/htmlheadelement.go index 9abf31b..fd1aa89 100644 --- a/htmlheadelement.go +++ b/htmlheadelement.go @@ -109,6 +109,9 @@ type HTMLHeadElement struct { } func JSValueToHTMLHeadElement(val js.Value) HTMLHeadElement { - return HTMLHeadElement{Value: Value{Value: val}} + return HTMLHeadElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLHeadElement() HTMLHeadElement { return HTMLHeadElement{Value: v} } +func NewHTMLHeadElement(args ...interface{}) HTMLHeadElement { + return HTMLHeadElement{Value: JSValueToValue(js.Global().Get("HTMLHeadElement").New(args...))} +} diff --git a/htmlheadingelement.go b/htmlheadingelement.go index ca4a21a..18cc947 100644 --- a/htmlheadingelement.go +++ b/htmlheadingelement.go @@ -111,9 +111,12 @@ type HTMLHeadingElement struct { } func JSValueToHTMLHeadingElement(val js.Value) HTMLHeadingElement { - return HTMLHeadingElement{Value: Value{Value: val}} + return HTMLHeadingElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLHeadingElement() HTMLHeadingElement { return HTMLHeadingElement{Value: v} } +func NewHTMLHeadingElement(args ...interface{}) HTMLHeadingElement { + return HTMLHeadingElement{Value: JSValueToValue(js.Global().Get("HTMLHeadingElement").New(args...))} +} func (h HTMLHeadingElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmlhrelement.go b/htmlhrelement.go index 3b7c74d..3326055 100644 --- a/htmlhrelement.go +++ b/htmlhrelement.go @@ -119,9 +119,12 @@ type HTMLHRElement struct { } func JSValueToHTMLHRElement(val js.Value) HTMLHRElement { - return HTMLHRElement{Value: Value{Value: val}} + return HTMLHRElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLHRElement() HTMLHRElement { return HTMLHRElement{Value: v} } +func NewHTMLHRElement(args ...interface{}) HTMLHRElement { + return HTMLHRElement{Value: JSValueToValue(js.Global().Get("HTMLHRElement").New(args...))} +} func (h HTMLHRElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmlhtmlelement.go b/htmlhtmlelement.go index bc099c3..c352187 100644 --- a/htmlhtmlelement.go +++ b/htmlhtmlelement.go @@ -111,9 +111,12 @@ type HTMLHtmlElement struct { } func JSValueToHTMLHtmlElement(val js.Value) HTMLHtmlElement { - return HTMLHtmlElement{Value: Value{Value: val}} + return HTMLHtmlElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLHtmlElement() HTMLHtmlElement { return HTMLHtmlElement{Value: v} } +func NewHTMLHtmlElement(args ...interface{}) HTMLHtmlElement { + return HTMLHtmlElement{Value: JSValueToValue(js.Global().Get("HTMLHtmlElement").New(args...))} +} func (h HTMLHtmlElement) GetVersion() string { val := h.Get("version") return val.String() diff --git a/htmliframeelement.go b/htmliframeelement.go index 7a010be..02ffea5 100644 --- a/htmliframeelement.go +++ b/htmliframeelement.go @@ -145,9 +145,12 @@ type HTMLIFrameElement struct { } func JSValueToHTMLIFrameElement(val js.Value) HTMLIFrameElement { - return HTMLIFrameElement{Value: Value{Value: val}} + return HTMLIFrameElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLIFrameElement() HTMLIFrameElement { return HTMLIFrameElement{Value: v} } +func NewHTMLIFrameElement(args ...interface{}) HTMLIFrameElement { + return HTMLIFrameElement{Value: JSValueToValue(js.Global().Get("HTMLIFrameElement").New(args...))} +} func (h HTMLIFrameElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmlimageelement.go b/htmlimageelement.go index e573987..3d02017 100644 --- a/htmlimageelement.go +++ b/htmlimageelement.go @@ -150,9 +150,12 @@ type HTMLImageElement struct { } func JSValueToHTMLImageElement(val js.Value) HTMLImageElement { - return HTMLImageElement{Value: Value{Value: val}} + return HTMLImageElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLImageElement() HTMLImageElement { return HTMLImageElement{Value: v} } +func NewHTMLImageElement(args ...interface{}) HTMLImageElement { + return HTMLImageElement{Value: JSValueToValue(js.Global().Get("HTMLImageElement").New(args...))} +} func (h HTMLImageElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmlinputelement.go b/htmlinputelement.go index b52ddaf..1a03296 100644 --- a/htmlinputelement.go +++ b/htmlinputelement.go @@ -204,9 +204,12 @@ type HTMLInputElement struct { } func JSValueToHTMLInputElement(val js.Value) HTMLInputElement { - return HTMLInputElement{Value: Value{Value: val}} + return HTMLInputElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLInputElement() HTMLInputElement { return HTMLInputElement{Value: v} } +func NewHTMLInputElement(args ...interface{}) HTMLInputElement { + return HTMLInputElement{Value: JSValueToValue(js.Global().Get("HTMLInputElement").New(args...))} +} func (h HTMLInputElement) GetAccept() string { val := h.Get("accept") return val.String() diff --git a/htmllabelelement.go b/htmllabelelement.go index c70ea5c..de65338 100644 --- a/htmllabelelement.go +++ b/htmllabelelement.go @@ -113,9 +113,12 @@ type HTMLLabelElement struct { } func JSValueToHTMLLabelElement(val js.Value) HTMLLabelElement { - return HTMLLabelElement{Value: Value{Value: val}} + return HTMLLabelElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLLabelElement() HTMLLabelElement { return HTMLLabelElement{Value: v} } +func NewHTMLLabelElement(args ...interface{}) HTMLLabelElement { + return HTMLLabelElement{Value: JSValueToValue(js.Global().Get("HTMLLabelElement").New(args...))} +} func (h HTMLLabelElement) GetControl() HTMLElement { val := h.Get("control") return JSValueToHTMLElement(val.JSValue()) diff --git a/htmllegendelement.go b/htmllegendelement.go index 04b3b69..9236471 100644 --- a/htmllegendelement.go +++ b/htmllegendelement.go @@ -112,9 +112,12 @@ type HTMLLegendElement struct { } func JSValueToHTMLLegendElement(val js.Value) HTMLLegendElement { - return HTMLLegendElement{Value: Value{Value: val}} + return HTMLLegendElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLLegendElement() HTMLLegendElement { return HTMLLegendElement{Value: v} } +func NewHTMLLegendElement(args ...interface{}) HTMLLegendElement { + return HTMLLegendElement{Value: JSValueToValue(js.Global().Get("HTMLLegendElement").New(args...))} +} func (h HTMLLegendElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmllielement.go b/htmllielement.go index 007cf8a..9152c30 100644 --- a/htmllielement.go +++ b/htmllielement.go @@ -113,9 +113,12 @@ type HTMLLIElement struct { } func JSValueToHTMLLIElement(val js.Value) HTMLLIElement { - return HTMLLIElement{Value: Value{Value: val}} + return HTMLLIElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLLIElement() HTMLLIElement { return HTMLLIElement{Value: v} } +func NewHTMLLIElement(args ...interface{}) HTMLLIElement { + return HTMLLIElement{Value: JSValueToValue(js.Global().Get("HTMLLIElement").New(args...))} +} func (h HTMLLIElement) GetType() string { val := h.Get("type") return val.String() diff --git a/htmllinkelement.go b/htmllinkelement.go index 130f8a6..3093964 100644 --- a/htmllinkelement.go +++ b/htmllinkelement.go @@ -136,9 +136,12 @@ type HTMLLinkElement struct { } func JSValueToHTMLLinkElement(val js.Value) HTMLLinkElement { - return HTMLLinkElement{Value: Value{Value: val}} + return HTMLLinkElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLLinkElement() HTMLLinkElement { return HTMLLinkElement{Value: v} } +func NewHTMLLinkElement(args ...interface{}) HTMLLinkElement { + return HTMLLinkElement{Value: JSValueToValue(js.Global().Get("HTMLLinkElement").New(args...))} +} func (h HTMLLinkElement) GetAs() string { val := h.Get("as") return val.String() diff --git a/htmlmapelement.go b/htmlmapelement.go index c2919ef..3845dbc 100644 --- a/htmlmapelement.go +++ b/htmlmapelement.go @@ -112,9 +112,12 @@ type HTMLMapElement struct { } func JSValueToHTMLMapElement(val js.Value) HTMLMapElement { - return HTMLMapElement{Value: Value{Value: val}} + return HTMLMapElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLMapElement() HTMLMapElement { return HTMLMapElement{Value: v} } +func NewHTMLMapElement(args ...interface{}) HTMLMapElement { + return HTMLMapElement{Value: JSValueToValue(js.Global().Get("HTMLMapElement").New(args...))} +} func (h HTMLMapElement) GetAreas() HTMLCollection { val := h.Get("areas") return JSValueToHTMLCollection(val.JSValue()) diff --git a/htmlmarqueeelement.go b/htmlmarqueeelement.go index 5b10c41..67338ef 100644 --- a/htmlmarqueeelement.go +++ b/htmlmarqueeelement.go @@ -139,9 +139,12 @@ type HTMLMarqueeElement struct { } func JSValueToHTMLMarqueeElement(val js.Value) HTMLMarqueeElement { - return HTMLMarqueeElement{Value: Value{Value: val}} + return HTMLMarqueeElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLMarqueeElement() HTMLMarqueeElement { return HTMLMarqueeElement{Value: v} } +func NewHTMLMarqueeElement(args ...interface{}) HTMLMarqueeElement { + return HTMLMarqueeElement{Value: JSValueToValue(js.Global().Get("HTMLMarqueeElement").New(args...))} +} func (h HTMLMarqueeElement) GetBehavior() string { val := h.Get("behavior") return val.String() diff --git a/htmlmediaelement.go b/htmlmediaelement.go index 2568f20..c8f6a42 100644 --- a/htmlmediaelement.go +++ b/htmlmediaelement.go @@ -156,9 +156,12 @@ type HTMLMediaElement struct { } func JSValueToHTMLMediaElement(val js.Value) HTMLMediaElement { - return HTMLMediaElement{Value: Value{Value: val}} + return HTMLMediaElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLMediaElement() HTMLMediaElement { return HTMLMediaElement{Value: v} } +func NewHTMLMediaElement(args ...interface{}) HTMLMediaElement { + return HTMLMediaElement{Value: JSValueToValue(js.Global().Get("HTMLMediaElement").New(args...))} +} func (h HTMLMediaElement) AddTextTrack(args ...interface{}) TextTrack { val := h.Call("addTextTrack", args...) return JSValueToTextTrack(val.JSValue()) diff --git a/htmlmenuelement.go b/htmlmenuelement.go index c81d5df..705d5b0 100644 --- a/htmlmenuelement.go +++ b/htmlmenuelement.go @@ -111,9 +111,12 @@ type HTMLMenuElement struct { } func JSValueToHTMLMenuElement(val js.Value) HTMLMenuElement { - return HTMLMenuElement{Value: Value{Value: val}} + return HTMLMenuElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLMenuElement() HTMLMenuElement { return HTMLMenuElement{Value: v} } +func NewHTMLMenuElement(args ...interface{}) HTMLMenuElement { + return HTMLMenuElement{Value: JSValueToValue(js.Global().Get("HTMLMenuElement").New(args...))} +} func (h HTMLMenuElement) GetCompact() bool { val := h.Get("compact") return val.Bool() diff --git a/htmlmetaelement.go b/htmlmetaelement.go index af866e1..8db363f 100644 --- a/htmlmetaelement.go +++ b/htmlmetaelement.go @@ -117,9 +117,12 @@ type HTMLMetaElement struct { } func JSValueToHTMLMetaElement(val js.Value) HTMLMetaElement { - return HTMLMetaElement{Value: Value{Value: val}} + return HTMLMetaElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLMetaElement() HTMLMetaElement { return HTMLMetaElement{Value: v} } +func NewHTMLMetaElement(args ...interface{}) HTMLMetaElement { + return HTMLMetaElement{Value: JSValueToValue(js.Global().Get("HTMLMetaElement").New(args...))} +} func (h HTMLMetaElement) GetContent() string { val := h.Get("content") return val.String() diff --git a/htmlmeterelement.go b/htmlmeterelement.go index a07d5a2..0b1fcce 100644 --- a/htmlmeterelement.go +++ b/htmlmeterelement.go @@ -122,9 +122,12 @@ type HTMLMeterElement struct { } func JSValueToHTMLMeterElement(val js.Value) HTMLMeterElement { - return HTMLMeterElement{Value: Value{Value: val}} + return HTMLMeterElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLMeterElement() HTMLMeterElement { return HTMLMeterElement{Value: v} } +func NewHTMLMeterElement(args ...interface{}) HTMLMeterElement { + return HTMLMeterElement{Value: JSValueToValue(js.Global().Get("HTMLMeterElement").New(args...))} +} func (h HTMLMeterElement) GetHigh() float64 { val := h.Get("high") return val.Float() diff --git a/htmlmodelement.go b/htmlmodelement.go index 2a399d6..5088eb7 100644 --- a/htmlmodelement.go +++ b/htmlmodelement.go @@ -113,9 +113,12 @@ type HTMLModElement struct { } func JSValueToHTMLModElement(val js.Value) HTMLModElement { - return HTMLModElement{Value: Value{Value: val}} + return HTMLModElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLModElement() HTMLModElement { return HTMLModElement{Value: v} } +func NewHTMLModElement(args ...interface{}) HTMLModElement { + return HTMLModElement{Value: JSValueToValue(js.Global().Get("HTMLModElement").New(args...))} +} func (h HTMLModElement) GetCite() string { val := h.Get("cite") return val.String() diff --git a/htmlobjectelement.go b/htmlobjectelement.go index 0b2b97f..5ffb393 100644 --- a/htmlobjectelement.go +++ b/htmlobjectelement.go @@ -153,9 +153,12 @@ type HTMLObjectElement struct { } func JSValueToHTMLObjectElement(val js.Value) HTMLObjectElement { - return HTMLObjectElement{Value: Value{Value: val}} + return HTMLObjectElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLObjectElement() HTMLObjectElement { return HTMLObjectElement{Value: v} } +func NewHTMLObjectElement(args ...interface{}) HTMLObjectElement { + return HTMLObjectElement{Value: JSValueToValue(js.Global().Get("HTMLObjectElement").New(args...))} +} func (h HTMLObjectElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmlolistelement.go b/htmlolistelement.go index 09a7fdb..f7f9634 100644 --- a/htmlolistelement.go +++ b/htmlolistelement.go @@ -117,9 +117,12 @@ type HTMLOListElement struct { } func JSValueToHTMLOListElement(val js.Value) HTMLOListElement { - return HTMLOListElement{Value: Value{Value: val}} + return HTMLOListElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLOListElement() HTMLOListElement { return HTMLOListElement{Value: v} } +func NewHTMLOListElement(args ...interface{}) HTMLOListElement { + return HTMLOListElement{Value: JSValueToValue(js.Global().Get("HTMLOListElement").New(args...))} +} func (h HTMLOListElement) GetCompact() bool { val := h.Get("compact") return val.Bool() diff --git a/htmloptgroupelement.go b/htmloptgroupelement.go index 058c377..68e373a 100644 --- a/htmloptgroupelement.go +++ b/htmloptgroupelement.go @@ -113,9 +113,12 @@ type HTMLOptGroupElement struct { } func JSValueToHTMLOptGroupElement(val js.Value) HTMLOptGroupElement { - return HTMLOptGroupElement{Value: Value{Value: val}} + return HTMLOptGroupElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLOptGroupElement() HTMLOptGroupElement { return HTMLOptGroupElement{Value: v} } +func NewHTMLOptGroupElement(args ...interface{}) HTMLOptGroupElement { + return HTMLOptGroupElement{Value: JSValueToValue(js.Global().Get("HTMLOptGroupElement").New(args...))} +} func (h HTMLOptGroupElement) GetDisabled() bool { val := h.Get("disabled") return val.Bool() diff --git a/htmloptionelement.go b/htmloptionelement.go index 4d7618c..1e882bd 100644 --- a/htmloptionelement.go +++ b/htmloptionelement.go @@ -123,9 +123,12 @@ type HTMLOptionElement struct { } func JSValueToHTMLOptionElement(val js.Value) HTMLOptionElement { - return HTMLOptionElement{Value: Value{Value: val}} + return HTMLOptionElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLOptionElement() HTMLOptionElement { return HTMLOptionElement{Value: v} } +func NewHTMLOptionElement(args ...interface{}) HTMLOptionElement { + return HTMLOptionElement{Value: JSValueToValue(js.Global().Get("HTMLOptionElement").New(args...))} +} func (h HTMLOptionElement) GetDefaultSelected() bool { val := h.Get("defaultSelected") return val.Bool() diff --git a/htmloptionscollection.go b/htmloptionscollection.go index 6fbe4f0..bc0addf 100644 --- a/htmloptionscollection.go +++ b/htmloptionscollection.go @@ -20,9 +20,12 @@ type HTMLOptionsCollection struct { } func JSValueToHTMLOptionsCollection(val js.Value) HTMLOptionsCollection { - return HTMLOptionsCollection{Value: Value{Value: val}} + return HTMLOptionsCollection{Value: JSValueToValue(val)} } func (v Value) AsHTMLOptionsCollection() HTMLOptionsCollection { return HTMLOptionsCollection{Value: v} } +func NewHTMLOptionsCollection(args ...interface{}) HTMLOptionsCollection { + return HTMLOptionsCollection{Value: JSValueToValue(js.Global().Get("HTMLOptionsCollection").New(args...))} +} func (h HTMLOptionsCollection) Add(args ...interface{}) { h.Call("add", args...) } diff --git a/htmloutputelement.go b/htmloutputelement.go index c38b642..0e6e03e 100644 --- a/htmloutputelement.go +++ b/htmloutputelement.go @@ -125,9 +125,12 @@ type HTMLOutputElement struct { } func JSValueToHTMLOutputElement(val js.Value) HTMLOutputElement { - return HTMLOutputElement{Value: Value{Value: val}} + return HTMLOutputElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLOutputElement() HTMLOutputElement { return HTMLOutputElement{Value: v} } +func NewHTMLOutputElement(args ...interface{}) HTMLOutputElement { + return HTMLOutputElement{Value: JSValueToValue(js.Global().Get("HTMLOutputElement").New(args...))} +} func (h HTMLOutputElement) CheckValidity(args ...interface{}) bool { val := h.Call("checkValidity", args...) return val.Bool() diff --git a/htmlparagraphelement.go b/htmlparagraphelement.go index 6cd281d..5999718 100644 --- a/htmlparagraphelement.go +++ b/htmlparagraphelement.go @@ -111,9 +111,12 @@ type HTMLParagraphElement struct { } func JSValueToHTMLParagraphElement(val js.Value) HTMLParagraphElement { - return HTMLParagraphElement{Value: Value{Value: val}} + return HTMLParagraphElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLParagraphElement() HTMLParagraphElement { return HTMLParagraphElement{Value: v} } +func NewHTMLParagraphElement(args ...interface{}) HTMLParagraphElement { + return HTMLParagraphElement{Value: JSValueToValue(js.Global().Get("HTMLParagraphElement").New(args...))} +} func (h HTMLParagraphElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmlparamelement.go b/htmlparamelement.go index 9cf506a..e03c22a 100644 --- a/htmlparamelement.go +++ b/htmlparamelement.go @@ -117,9 +117,12 @@ type HTMLParamElement struct { } func JSValueToHTMLParamElement(val js.Value) HTMLParamElement { - return HTMLParamElement{Value: Value{Value: val}} + return HTMLParamElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLParamElement() HTMLParamElement { return HTMLParamElement{Value: v} } +func NewHTMLParamElement(args ...interface{}) HTMLParamElement { + return HTMLParamElement{Value: JSValueToValue(js.Global().Get("HTMLParamElement").New(args...))} +} func (h HTMLParamElement) GetName() string { val := h.Get("name") return val.String() diff --git a/htmlpictureelement.go b/htmlpictureelement.go index 94818d4..a276af9 100644 --- a/htmlpictureelement.go +++ b/htmlpictureelement.go @@ -109,6 +109,9 @@ type HTMLPictureElement struct { } func JSValueToHTMLPictureElement(val js.Value) HTMLPictureElement { - return HTMLPictureElement{Value: Value{Value: val}} + return HTMLPictureElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLPictureElement() HTMLPictureElement { return HTMLPictureElement{Value: v} } +func NewHTMLPictureElement(args ...interface{}) HTMLPictureElement { + return HTMLPictureElement{Value: JSValueToValue(js.Global().Get("HTMLPictureElement").New(args...))} +} diff --git a/htmlpreelement.go b/htmlpreelement.go index 7f800aa..64b4a9a 100644 --- a/htmlpreelement.go +++ b/htmlpreelement.go @@ -111,9 +111,12 @@ type HTMLPreElement struct { } func JSValueToHTMLPreElement(val js.Value) HTMLPreElement { - return HTMLPreElement{Value: Value{Value: val}} + return HTMLPreElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLPreElement() HTMLPreElement { return HTMLPreElement{Value: v} } +func NewHTMLPreElement(args ...interface{}) HTMLPreElement { + return HTMLPreElement{Value: JSValueToValue(js.Global().Get("HTMLPreElement").New(args...))} +} func (h HTMLPreElement) GetWidth() int { val := h.Get("width") return val.Int() diff --git a/htmlprogresselement.go b/htmlprogresselement.go index 9675820..0fefda8 100644 --- a/htmlprogresselement.go +++ b/htmlprogresselement.go @@ -115,9 +115,12 @@ type HTMLProgressElement struct { } func JSValueToHTMLProgressElement(val js.Value) HTMLProgressElement { - return HTMLProgressElement{Value: Value{Value: val}} + return HTMLProgressElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLProgressElement() HTMLProgressElement { return HTMLProgressElement{Value: v} } +func NewHTMLProgressElement(args ...interface{}) HTMLProgressElement { + return HTMLProgressElement{Value: JSValueToValue(js.Global().Get("HTMLProgressElement").New(args...))} +} func (h HTMLProgressElement) GetLabels() NodeList { val := h.Get("labels") return JSValueToNodeList(val.JSValue()) diff --git a/htmlquoteelement.go b/htmlquoteelement.go index e382f5b..8b6f231 100644 --- a/htmlquoteelement.go +++ b/htmlquoteelement.go @@ -111,9 +111,12 @@ type HTMLQuoteElement struct { } func JSValueToHTMLQuoteElement(val js.Value) HTMLQuoteElement { - return HTMLQuoteElement{Value: Value{Value: val}} + return HTMLQuoteElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLQuoteElement() HTMLQuoteElement { return HTMLQuoteElement{Value: v} } +func NewHTMLQuoteElement(args ...interface{}) HTMLQuoteElement { + return HTMLQuoteElement{Value: JSValueToValue(js.Global().Get("HTMLQuoteElement").New(args...))} +} func (h HTMLQuoteElement) GetCite() string { val := h.Get("cite") return val.String() diff --git a/htmlscriptelement.go b/htmlscriptelement.go index 16a28f4..e64cef8 100644 --- a/htmlscriptelement.go +++ b/htmlscriptelement.go @@ -133,9 +133,12 @@ type HTMLScriptElement struct { } func JSValueToHTMLScriptElement(val js.Value) HTMLScriptElement { - return HTMLScriptElement{Value: Value{Value: val}} + return HTMLScriptElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLScriptElement() HTMLScriptElement { return HTMLScriptElement{Value: v} } +func NewHTMLScriptElement(args ...interface{}) HTMLScriptElement { + return HTMLScriptElement{Value: JSValueToValue(js.Global().Get("HTMLScriptElement").New(args...))} +} func (h HTMLScriptElement) GetAsync() bool { val := h.Get("async") return val.Bool() diff --git a/htmlselectelement.go b/htmlselectelement.go index 7e1060f..ab81473 100644 --- a/htmlselectelement.go +++ b/htmlselectelement.go @@ -145,9 +145,12 @@ type HTMLSelectElement struct { } func JSValueToHTMLSelectElement(val js.Value) HTMLSelectElement { - return HTMLSelectElement{Value: Value{Value: val}} + return HTMLSelectElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLSelectElement() HTMLSelectElement { return HTMLSelectElement{Value: v} } +func NewHTMLSelectElement(args ...interface{}) HTMLSelectElement { + return HTMLSelectElement{Value: JSValueToValue(js.Global().Get("HTMLSelectElement").New(args...))} +} func (h HTMLSelectElement) Add(args ...interface{}) { h.Call("add", args...) } diff --git a/htmlslotelement.go b/htmlslotelement.go index 6161b2e..3b1623e 100644 --- a/htmlslotelement.go +++ b/htmlslotelement.go @@ -113,9 +113,12 @@ type HTMLSlotElement struct { } func JSValueToHTMLSlotElement(val js.Value) HTMLSlotElement { - return HTMLSlotElement{Value: Value{Value: val}} + return HTMLSlotElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLSlotElement() HTMLSlotElement { return HTMLSlotElement{Value: v} } +func NewHTMLSlotElement(args ...interface{}) HTMLSlotElement { + return HTMLSlotElement{Value: JSValueToValue(js.Global().Get("HTMLSlotElement").New(args...))} +} func (h HTMLSlotElement) AssignedElements(args ...interface{}) { h.Call("assignedElements", args...) } diff --git a/htmlsourceelement.go b/htmlsourceelement.go index b7ccb14..739e42a 100644 --- a/htmlsourceelement.go +++ b/htmlsourceelement.go @@ -119,9 +119,12 @@ type HTMLSourceElement struct { } func JSValueToHTMLSourceElement(val js.Value) HTMLSourceElement { - return HTMLSourceElement{Value: Value{Value: val}} + return HTMLSourceElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLSourceElement() HTMLSourceElement { return HTMLSourceElement{Value: v} } +func NewHTMLSourceElement(args ...interface{}) HTMLSourceElement { + return HTMLSourceElement{Value: JSValueToValue(js.Global().Get("HTMLSourceElement").New(args...))} +} func (h HTMLSourceElement) GetMedia() string { val := h.Get("media") return val.String() diff --git a/htmlspanelement.go b/htmlspanelement.go index b5efc8e..8a12402 100644 --- a/htmlspanelement.go +++ b/htmlspanelement.go @@ -109,6 +109,9 @@ type HTMLSpanElement struct { } func JSValueToHTMLSpanElement(val js.Value) HTMLSpanElement { - return HTMLSpanElement{Value: Value{Value: val}} + return HTMLSpanElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLSpanElement() HTMLSpanElement { return HTMLSpanElement{Value: v} } +func NewHTMLSpanElement(args ...interface{}) HTMLSpanElement { + return HTMLSpanElement{Value: JSValueToValue(js.Global().Get("HTMLSpanElement").New(args...))} +} diff --git a/htmlstyleelement.go b/htmlstyleelement.go index 77e87a7..44fb0ca 100644 --- a/htmlstyleelement.go +++ b/htmlstyleelement.go @@ -114,9 +114,12 @@ type HTMLStyleElement struct { } func JSValueToHTMLStyleElement(val js.Value) HTMLStyleElement { - return HTMLStyleElement{Value: Value{Value: val}} + return HTMLStyleElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLStyleElement() HTMLStyleElement { return HTMLStyleElement{Value: v} } +func NewHTMLStyleElement(args ...interface{}) HTMLStyleElement { + return HTMLStyleElement{Value: JSValueToValue(js.Global().Get("HTMLStyleElement").New(args...))} +} func (h HTMLStyleElement) GetMedia() string { val := h.Get("media") return val.String() diff --git a/htmltablecaptionelement.go b/htmltablecaptionelement.go index 133ef45..827c44c 100644 --- a/htmltablecaptionelement.go +++ b/htmltablecaptionelement.go @@ -111,11 +111,14 @@ type HTMLTableCaptionElement struct { } func JSValueToHTMLTableCaptionElement(val js.Value) HTMLTableCaptionElement { - return HTMLTableCaptionElement{Value: Value{Value: val}} + return HTMLTableCaptionElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLTableCaptionElement() HTMLTableCaptionElement { return HTMLTableCaptionElement{Value: v} } +func NewHTMLTableCaptionElement(args ...interface{}) HTMLTableCaptionElement { + return HTMLTableCaptionElement{Value: JSValueToValue(js.Global().Get("HTMLTableCaptionElement").New(args...))} +} func (h HTMLTableCaptionElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmltablecellelement.go b/htmltablecellelement.go index 0cf80db..607de0a 100644 --- a/htmltablecellelement.go +++ b/htmltablecellelement.go @@ -138,9 +138,12 @@ type HTMLTableCellElement struct { } func JSValueToHTMLTableCellElement(val js.Value) HTMLTableCellElement { - return HTMLTableCellElement{Value: Value{Value: val}} + return HTMLTableCellElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLTableCellElement() HTMLTableCellElement { return HTMLTableCellElement{Value: v} } +func NewHTMLTableCellElement(args ...interface{}) HTMLTableCellElement { + return HTMLTableCellElement{Value: JSValueToValue(js.Global().Get("HTMLTableCellElement").New(args...))} +} func (h HTMLTableCellElement) GetAbbr() string { val := h.Get("abbr") return val.String() diff --git a/htmltablecolelement.go b/htmltablecolelement.go index 1601525..8d0b0b6 100644 --- a/htmltablecolelement.go +++ b/htmltablecolelement.go @@ -121,9 +121,12 @@ type HTMLTableColElement struct { } func JSValueToHTMLTableColElement(val js.Value) HTMLTableColElement { - return HTMLTableColElement{Value: Value{Value: val}} + return HTMLTableColElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLTableColElement() HTMLTableColElement { return HTMLTableColElement{Value: v} } +func NewHTMLTableColElement(args ...interface{}) HTMLTableColElement { + return HTMLTableColElement{Value: JSValueToValue(js.Global().Get("HTMLTableColElement").New(args...))} +} func (h HTMLTableColElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmltableelement.go b/htmltableelement.go index d557e0b..87dbbbc 100644 --- a/htmltableelement.go +++ b/htmltableelement.go @@ -144,9 +144,12 @@ type HTMLTableElement struct { } func JSValueToHTMLTableElement(val js.Value) HTMLTableElement { - return HTMLTableElement{Value: Value{Value: val}} + return HTMLTableElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLTableElement() HTMLTableElement { return HTMLTableElement{Value: v} } +func NewHTMLTableElement(args ...interface{}) HTMLTableElement { + return HTMLTableElement{Value: JSValueToValue(js.Global().Get("HTMLTableElement").New(args...))} +} func (h HTMLTableElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmltablerowelement.go b/htmltablerowelement.go index df269c2..a0bd2aa 100644 --- a/htmltablerowelement.go +++ b/htmltablerowelement.go @@ -124,9 +124,12 @@ type HTMLTableRowElement struct { } func JSValueToHTMLTableRowElement(val js.Value) HTMLTableRowElement { - return HTMLTableRowElement{Value: Value{Value: val}} + return HTMLTableRowElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLTableRowElement() HTMLTableRowElement { return HTMLTableRowElement{Value: v} } +func NewHTMLTableRowElement(args ...interface{}) HTMLTableRowElement { + return HTMLTableRowElement{Value: JSValueToValue(js.Global().Get("HTMLTableRowElement").New(args...))} +} func (h HTMLTableRowElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmltablesectionelement.go b/htmltablesectionelement.go index e4747a2..35c08c5 100644 --- a/htmltablesectionelement.go +++ b/htmltablesectionelement.go @@ -120,11 +120,14 @@ type HTMLTableSectionElement struct { } func JSValueToHTMLTableSectionElement(val js.Value) HTMLTableSectionElement { - return HTMLTableSectionElement{Value: Value{Value: val}} + return HTMLTableSectionElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLTableSectionElement() HTMLTableSectionElement { return HTMLTableSectionElement{Value: v} } +func NewHTMLTableSectionElement(args ...interface{}) HTMLTableSectionElement { + return HTMLTableSectionElement{Value: JSValueToValue(js.Global().Get("HTMLTableSectionElement").New(args...))} +} func (h HTMLTableSectionElement) GetAlign() string { val := h.Get("align") return val.String() diff --git a/htmltemplateelement.go b/htmltemplateelement.go index a846d44..39566da 100644 --- a/htmltemplateelement.go +++ b/htmltemplateelement.go @@ -110,9 +110,12 @@ type HTMLTemplateElement struct { } func JSValueToHTMLTemplateElement(val js.Value) HTMLTemplateElement { - return HTMLTemplateElement{Value: Value{Value: val}} + return HTMLTemplateElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLTemplateElement() HTMLTemplateElement { return HTMLTemplateElement{Value: v} } +func NewHTMLTemplateElement(args ...interface{}) HTMLTemplateElement { + return HTMLTemplateElement{Value: JSValueToValue(js.Global().Get("HTMLTemplateElement").New(args...))} +} func (h HTMLTemplateElement) GetContent() DocumentFragment { val := h.Get("content") return JSValueToDocumentFragment(val.JSValue()) diff --git a/htmltextareaelement.go b/htmltextareaelement.go index be2df36..110dd78 100644 --- a/htmltextareaelement.go +++ b/htmltextareaelement.go @@ -159,9 +159,12 @@ type HTMLTextAreaElement struct { } func JSValueToHTMLTextAreaElement(val js.Value) HTMLTextAreaElement { - return HTMLTextAreaElement{Value: Value{Value: val}} + return HTMLTextAreaElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLTextAreaElement() HTMLTextAreaElement { return HTMLTextAreaElement{Value: v} } +func NewHTMLTextAreaElement(args ...interface{}) HTMLTextAreaElement { + return HTMLTextAreaElement{Value: JSValueToValue(js.Global().Get("HTMLTextAreaElement").New(args...))} +} func (h HTMLTextAreaElement) GetAutocomplete() string { val := h.Get("autocomplete") return val.String() diff --git a/htmltimeelement.go b/htmltimeelement.go index 6a046cb..bad12c1 100644 --- a/htmltimeelement.go +++ b/htmltimeelement.go @@ -111,9 +111,12 @@ type HTMLTimeElement struct { } func JSValueToHTMLTimeElement(val js.Value) HTMLTimeElement { - return HTMLTimeElement{Value: Value{Value: val}} + return HTMLTimeElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLTimeElement() HTMLTimeElement { return HTMLTimeElement{Value: v} } +func NewHTMLTimeElement(args ...interface{}) HTMLTimeElement { + return HTMLTimeElement{Value: JSValueToValue(js.Global().Get("HTMLTimeElement").New(args...))} +} func (h HTMLTimeElement) GetDateTime() string { val := h.Get("dateTime") return val.String() diff --git a/htmltitleelement.go b/htmltitleelement.go index 06d7582..e69ed60 100644 --- a/htmltitleelement.go +++ b/htmltitleelement.go @@ -111,9 +111,12 @@ type HTMLTitleElement struct { } func JSValueToHTMLTitleElement(val js.Value) HTMLTitleElement { - return HTMLTitleElement{Value: Value{Value: val}} + return HTMLTitleElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLTitleElement() HTMLTitleElement { return HTMLTitleElement{Value: v} } +func NewHTMLTitleElement(args ...interface{}) HTMLTitleElement { + return HTMLTitleElement{Value: JSValueToValue(js.Global().Get("HTMLTitleElement").New(args...))} +} func (h HTMLTitleElement) GetText() string { val := h.Get("text") return val.String() diff --git a/htmltrackelement.go b/htmltrackelement.go index 33accf1..939fb0f 100644 --- a/htmltrackelement.go +++ b/htmltrackelement.go @@ -121,9 +121,12 @@ type HTMLTrackElement struct { } func JSValueToHTMLTrackElement(val js.Value) HTMLTrackElement { - return HTMLTrackElement{Value: Value{Value: val}} + return HTMLTrackElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLTrackElement() HTMLTrackElement { return HTMLTrackElement{Value: v} } +func NewHTMLTrackElement(args ...interface{}) HTMLTrackElement { + return HTMLTrackElement{Value: JSValueToValue(js.Global().Get("HTMLTrackElement").New(args...))} +} func (h HTMLTrackElement) GetDefault() bool { val := h.Get("default") return val.Bool() diff --git a/htmlulistelement.go b/htmlulistelement.go index 809c5d4..a7ce434 100644 --- a/htmlulistelement.go +++ b/htmlulistelement.go @@ -113,9 +113,12 @@ type HTMLUListElement struct { } func JSValueToHTMLUListElement(val js.Value) HTMLUListElement { - return HTMLUListElement{Value: Value{Value: val}} + return HTMLUListElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLUListElement() HTMLUListElement { return HTMLUListElement{Value: v} } +func NewHTMLUListElement(args ...interface{}) HTMLUListElement { + return HTMLUListElement{Value: JSValueToValue(js.Global().Get("HTMLUListElement").New(args...))} +} func (h HTMLUListElement) GetCompact() bool { val := h.Get("compact") return val.Bool() diff --git a/htmlunknownelement.go b/htmlunknownelement.go index 978afa8..f2847ba 100644 --- a/htmlunknownelement.go +++ b/htmlunknownelement.go @@ -109,6 +109,9 @@ type HTMLUnknownElement struct { } func JSValueToHTMLUnknownElement(val js.Value) HTMLUnknownElement { - return HTMLUnknownElement{Value: Value{Value: val}} + return HTMLUnknownElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLUnknownElement() HTMLUnknownElement { return HTMLUnknownElement{Value: v} } +func NewHTMLUnknownElement(args ...interface{}) HTMLUnknownElement { + return HTMLUnknownElement{Value: JSValueToValue(js.Global().Get("HTMLUnknownElement").New(args...))} +} diff --git a/htmlvideoelement.go b/htmlvideoelement.go index 248e54b..447522c 100644 --- a/htmlvideoelement.go +++ b/htmlvideoelement.go @@ -167,9 +167,12 @@ type HTMLVideoElement struct { } func JSValueToHTMLVideoElement(val js.Value) HTMLVideoElement { - return HTMLVideoElement{Value: Value{Value: val}} + return HTMLVideoElement{Value: JSValueToValue(val)} } func (v Value) AsHTMLVideoElement() HTMLVideoElement { return HTMLVideoElement{Value: v} } +func NewHTMLVideoElement(args ...interface{}) HTMLVideoElement { + return HTMLVideoElement{Value: JSValueToValue(js.Global().Get("HTMLVideoElement").New(args...))} +} func (h HTMLVideoElement) GetHeight() int { val := h.Get("height") return val.Int() diff --git a/imagebitmap.go b/imagebitmap.go index 397677c..06fd285 100644 --- a/imagebitmap.go +++ b/imagebitmap.go @@ -13,8 +13,11 @@ type ImageBitmap struct { Value } -func JSValueToImageBitmap(val js.Value) ImageBitmap { return ImageBitmap{Value: Value{Value: val}} } +func JSValueToImageBitmap(val js.Value) ImageBitmap { return ImageBitmap{Value: JSValueToValue(val)} } func (v Value) AsImageBitmap() ImageBitmap { return ImageBitmap{Value: v} } +func NewImageBitmap(args ...interface{}) ImageBitmap { + return ImageBitmap{Value: JSValueToValue(js.Global().Get("ImageBitmap").New(args...))} +} func (i ImageBitmap) Close(args ...interface{}) { i.Call("close", args...) } diff --git a/imagebitmaprenderingcontext.go b/imagebitmaprenderingcontext.go index 234f1b1..c9f61c5 100644 --- a/imagebitmaprenderingcontext.go +++ b/imagebitmaprenderingcontext.go @@ -13,11 +13,14 @@ type ImageBitmapRenderingContext struct { } func JSValueToImageBitmapRenderingContext(val js.Value) ImageBitmapRenderingContext { - return ImageBitmapRenderingContext{Value: Value{Value: val}} + return ImageBitmapRenderingContext{Value: JSValueToValue(val)} } func (v Value) AsImageBitmapRenderingContext() ImageBitmapRenderingContext { return ImageBitmapRenderingContext{Value: v} } +func NewImageBitmapRenderingContext(args ...interface{}) ImageBitmapRenderingContext { + return ImageBitmapRenderingContext{Value: JSValueToValue(js.Global().Get("ImageBitmapRenderingContext").New(args...))} +} func (i ImageBitmapRenderingContext) GetCanvas() HTMLCanvasElement { val := i.Get("canvas") return JSValueToHTMLCanvasElement(val.JSValue()) diff --git a/imagedata.go b/imagedata.go index 8c01c20..3af4fdd 100644 --- a/imagedata.go +++ b/imagedata.go @@ -13,8 +13,11 @@ type ImageData struct { Value } -func JSValueToImageData(val js.Value) ImageData { return ImageData{Value: Value{Value: val}} } +func JSValueToImageData(val js.Value) ImageData { return ImageData{Value: JSValueToValue(val)} } func (v Value) AsImageData() ImageData { return ImageData{Value: v} } +func NewImageData(args ...interface{}) ImageData { + return ImageData{Value: JSValueToValue(js.Global().Get("ImageData").New(args...))} +} func (i ImageData) GetData() Uint8ClampedArray { val := i.Get("data") return JSValueToUint8ClampedArray(val.JSValue()) diff --git a/location.go b/location.go index e8bd765..b80cb66 100644 --- a/location.go +++ b/location.go @@ -31,8 +31,11 @@ type Location struct { Value } -func JSValueToLocation(val js.Value) Location { return Location{Value: Value{Value: val}} } +func JSValueToLocation(val js.Value) Location { return Location{Value: JSValueToValue(val)} } func (v Value) AsLocation() Location { return Location{Value: v} } +func NewLocation(args ...interface{}) Location { + return Location{Value: JSValueToValue(js.Global().Get("Location").New(args...))} +} func (l Location) GetAncestorOrigins() DOMStringList { val := l.Get("ancestorOrigins") return JSValueToDOMStringList(val.JSValue()) diff --git a/mediaerror.go b/mediaerror.go index 5f479c4..5418c44 100644 --- a/mediaerror.go +++ b/mediaerror.go @@ -12,8 +12,11 @@ type MediaError struct { Value } -func JSValueToMediaError(val js.Value) MediaError { return MediaError{Value: Value{Value: val}} } +func JSValueToMediaError(val js.Value) MediaError { return MediaError{Value: JSValueToValue(val)} } func (v Value) AsMediaError() MediaError { return MediaError{Value: v} } +func NewMediaError(args ...interface{}) MediaError { + return MediaError{Value: JSValueToValue(js.Global().Get("MediaError").New(args...))} +} func (m MediaError) GetCode() int { val := m.Get("code") return val.Int() diff --git a/medialist.go b/medialist.go index cc73e9f..51c6252 100644 --- a/medialist.go +++ b/medialist.go @@ -16,8 +16,11 @@ type MediaList struct { Value } -func JSValueToMediaList(val js.Value) MediaList { return MediaList{Value: Value{Value: val}} } +func JSValueToMediaList(val js.Value) MediaList { return MediaList{Value: JSValueToValue(val)} } func (v Value) AsMediaList() MediaList { return MediaList{Value: v} } +func NewMediaList(args ...interface{}) MediaList { + return MediaList{Value: JSValueToValue(js.Global().Get("MediaList").New(args...))} +} func (m MediaList) AppendMedium(args ...interface{}) { m.Call("appendMedium", args...) } diff --git a/messagechannel.go b/messagechannel.go index db73663..882eba4 100644 --- a/messagechannel.go +++ b/messagechannel.go @@ -13,9 +13,12 @@ type MessageChannel struct { } func JSValueToMessageChannel(val js.Value) MessageChannel { - return MessageChannel{Value: Value{Value: val}} + return MessageChannel{Value: JSValueToValue(val)} } func (v Value) AsMessageChannel() MessageChannel { return MessageChannel{Value: v} } +func NewMessageChannel(args ...interface{}) MessageChannel { + return MessageChannel{Value: JSValueToValue(js.Global().Get("MessageChannel").New(args...))} +} func (m MessageChannel) GetPort1() MessagePort { val := m.Get("port1") return JSValueToMessagePort(val.JSValue()) diff --git a/messageevent.go b/messageevent.go index 9adbdcb..da1f567 100644 --- a/messageevent.go +++ b/messageevent.go @@ -37,8 +37,11 @@ type MessageEvent struct { Event } -func JSValueToMessageEvent(val js.Value) MessageEvent { return MessageEvent{Value: Value{Value: val}} } +func JSValueToMessageEvent(val js.Value) MessageEvent { return MessageEvent{Value: JSValueToValue(val)} } func (v Value) AsMessageEvent() MessageEvent { return MessageEvent{Value: v} } +func NewMessageEvent(args ...interface{}) MessageEvent { + return MessageEvent{Value: JSValueToValue(js.Global().Get("MessageEvent").New(args...))} +} func (m MessageEvent) GetData() Value { val := m.Get("data") return val diff --git a/messageport.go b/messageport.go index 29d0eef..a1249b5 100644 --- a/messageport.go +++ b/messageport.go @@ -21,8 +21,11 @@ type MessagePort struct { EventTarget } -func JSValueToMessagePort(val js.Value) MessagePort { return MessagePort{Value: Value{Value: val}} } +func JSValueToMessagePort(val js.Value) MessagePort { return MessagePort{Value: JSValueToValue(val)} } func (v Value) AsMessagePort() MessagePort { return MessagePort{Value: v} } +func NewMessagePort(args ...interface{}) MessagePort { + return MessagePort{Value: JSValueToValue(js.Global().Get("MessagePort").New(args...))} +} func (m MessagePort) Close(args ...interface{}) { m.Call("close", args...) } diff --git a/mimetype.go b/mimetype.go index 1792326..01e1b6e 100644 --- a/mimetype.go +++ b/mimetype.go @@ -14,8 +14,11 @@ type MimeType struct { Value } -func JSValueToMimeType(val js.Value) MimeType { return MimeType{Value: Value{Value: val}} } +func JSValueToMimeType(val js.Value) MimeType { return MimeType{Value: JSValueToValue(val)} } func (v Value) AsMimeType() MimeType { return MimeType{Value: v} } +func NewMimeType(args ...interface{}) MimeType { + return MimeType{Value: JSValueToValue(js.Global().Get("MimeType").New(args...))} +} func (m MimeType) GetDescription() string { val := m.Get("description") return val.String() diff --git a/mimetypearray.go b/mimetypearray.go index 4d55fec..5089e32 100644 --- a/mimetypearray.go +++ b/mimetypearray.go @@ -14,9 +14,12 @@ type MimeTypeArray struct { } func JSValueToMimeTypeArray(val js.Value) MimeTypeArray { - return MimeTypeArray{Value: Value{Value: val}} + return MimeTypeArray{Value: JSValueToValue(val)} } func (v Value) AsMimeTypeArray() MimeTypeArray { return MimeTypeArray{Value: v} } +func NewMimeTypeArray(args ...interface{}) MimeTypeArray { + return MimeTypeArray{Value: JSValueToValue(js.Global().Get("MimeTypeArray").New(args...))} +} func (m MimeTypeArray) Item(args ...interface{}) MimeType { val := m.Call("item", args...) return JSValueToMimeType(val.JSValue()) diff --git a/mutationobserver.go b/mutationobserver.go index 3aa8926..46d744f 100644 --- a/mutationobserver.go +++ b/mutationobserver.go @@ -14,9 +14,12 @@ type MutationObserver struct { } func JSValueToMutationObserver(val js.Value) MutationObserver { - return MutationObserver{Value: Value{Value: val}} + return MutationObserver{Value: JSValueToValue(val)} } func (v Value) AsMutationObserver() MutationObserver { return MutationObserver{Value: v} } +func NewMutationObserver(args ...interface{}) MutationObserver { + return MutationObserver{Value: JSValueToValue(js.Global().Get("MutationObserver").New(args...))} +} func (m MutationObserver) Disconnect(args ...interface{}) { m.Call("disconnect", args...) } diff --git a/mutationrecord.go b/mutationrecord.go index 9a8c9d1..34a2774 100644 --- a/mutationrecord.go +++ b/mutationrecord.go @@ -20,9 +20,12 @@ type MutationRecord struct { } func JSValueToMutationRecord(val js.Value) MutationRecord { - return MutationRecord{Value: Value{Value: val}} + return MutationRecord{Value: JSValueToValue(val)} } func (v Value) AsMutationRecord() MutationRecord { return MutationRecord{Value: v} } +func NewMutationRecord(args ...interface{}) MutationRecord { + return MutationRecord{Value: JSValueToValue(js.Global().Get("MutationRecord").New(args...))} +} func (m MutationRecord) GetAddedNodes() NodeList { val := m.Get("addedNodes") return JSValueToNodeList(val.JSValue()) diff --git a/namednodemap.go b/namednodemap.go index 5864471..7640839 100644 --- a/namednodemap.go +++ b/namednodemap.go @@ -18,8 +18,11 @@ type NamedNodeMap struct { Value } -func JSValueToNamedNodeMap(val js.Value) NamedNodeMap { return NamedNodeMap{Value: Value{Value: val}} } +func JSValueToNamedNodeMap(val js.Value) NamedNodeMap { return NamedNodeMap{Value: JSValueToValue(val)} } func (v Value) AsNamedNodeMap() NamedNodeMap { return NamedNodeMap{Value: v} } +func NewNamedNodeMap(args ...interface{}) NamedNodeMap { + return NamedNodeMap{Value: JSValueToValue(js.Global().Get("NamedNodeMap").New(args...))} +} func (n NamedNodeMap) GetNamedItem(args ...interface{}) Attr { val := n.Call("getNamedItem", args...) return JSValueToAttr(val.JSValue()) diff --git a/navigator.go b/navigator.go index a9c9254..85e7fb3 100644 --- a/navigator.go +++ b/navigator.go @@ -30,8 +30,11 @@ type Navigator struct { Value } -func JSValueToNavigator(val js.Value) Navigator { return Navigator{Value: Value{Value: val}} } +func JSValueToNavigator(val js.Value) Navigator { return Navigator{Value: JSValueToValue(val)} } func (v Value) AsNavigator() Navigator { return Navigator{Value: v} } +func NewNavigator(args ...interface{}) Navigator { + return Navigator{Value: JSValueToValue(js.Global().Get("Navigator").New(args...))} +} func (n Navigator) GetAppCodeName() string { val := n.Get("appCodeName") return val.String() diff --git a/node.go b/node.go index 9a4ed3b..64f063e 100644 --- a/node.go +++ b/node.go @@ -45,8 +45,11 @@ type Node struct { EventTarget } -func JSValueToNode(val js.Value) Node { return Node{Value: Value{Value: val}} } +func JSValueToNode(val js.Value) Node { return Node{Value: JSValueToValue(val)} } func (v Value) AsNode() Node { return Node{Value: v} } +func NewNode(args ...interface{}) Node { + return Node{Value: JSValueToValue(js.Global().Get("Node").New(args...))} +} func (n Node) AppendChild(args ...interface{}) Node { val := n.Call("appendChild", args...) return JSValueToNode(val.JSValue()) diff --git a/nodeiterator.go b/nodeiterator.go index d34fb8c..5d74366 100644 --- a/nodeiterator.go +++ b/nodeiterator.go @@ -18,8 +18,11 @@ type NodeIterator struct { Value } -func JSValueToNodeIterator(val js.Value) NodeIterator { return NodeIterator{Value: Value{Value: val}} } +func JSValueToNodeIterator(val js.Value) NodeIterator { return NodeIterator{Value: JSValueToValue(val)} } func (v Value) AsNodeIterator() NodeIterator { return NodeIterator{Value: v} } +func NewNodeIterator(args ...interface{}) NodeIterator { + return NodeIterator{Value: JSValueToValue(js.Global().Get("NodeIterator").New(args...))} +} func (n NodeIterator) Detach(args ...interface{}) { n.Call("detach", args...) } diff --git a/nodelist.go b/nodelist.go index ba90ee2..22c877e 100644 --- a/nodelist.go +++ b/nodelist.go @@ -12,8 +12,11 @@ type NodeList struct { Value } -func JSValueToNodeList(val js.Value) NodeList { return NodeList{Value: Value{Value: val}} } +func JSValueToNodeList(val js.Value) NodeList { return NodeList{Value: JSValueToValue(val)} } func (v Value) AsNodeList() NodeList { return NodeList{Value: v} } +func NewNodeList(args ...interface{}) NodeList { + return NodeList{Value: JSValueToValue(js.Global().Get("NodeList").New(args...))} +} func (n NodeList) Item(args ...interface{}) Node { val := n.Call("item", args...) return JSValueToNode(val.JSValue()) diff --git a/offscreencanvas.go b/offscreencanvas.go index 8e99cce..0dc5fb4 100644 --- a/offscreencanvas.go +++ b/offscreencanvas.go @@ -22,9 +22,12 @@ type OffscreenCanvas struct { } func JSValueToOffscreenCanvas(val js.Value) OffscreenCanvas { - return OffscreenCanvas{Value: Value{Value: val}} + return OffscreenCanvas{Value: JSValueToValue(val)} } func (v Value) AsOffscreenCanvas() OffscreenCanvas { return OffscreenCanvas{Value: v} } +func NewOffscreenCanvas(args ...interface{}) OffscreenCanvas { + return OffscreenCanvas{Value: JSValueToValue(js.Global().Get("OffscreenCanvas").New(args...))} +} func (o OffscreenCanvas) ConvertToBlob(args ...interface{}) { o.Call("convertToBlob", args...) } diff --git a/offscreencanvasrenderingcontext2d.go b/offscreencanvasrenderingcontext2d.go index 242d2a3..faa4e16 100644 --- a/offscreencanvasrenderingcontext2d.go +++ b/offscreencanvasrenderingcontext2d.go @@ -100,11 +100,14 @@ type OffscreenCanvasRenderingContext2D struct { } func JSValueToOffscreenCanvasRenderingContext2D(val js.Value) OffscreenCanvasRenderingContext2D { - return OffscreenCanvasRenderingContext2D{Value: Value{Value: val}} + return OffscreenCanvasRenderingContext2D{Value: JSValueToValue(val)} } func (v Value) AsOffscreenCanvasRenderingContext2D() OffscreenCanvasRenderingContext2D { return OffscreenCanvasRenderingContext2D{Value: v} } +func NewOffscreenCanvasRenderingContext2D(args ...interface{}) OffscreenCanvasRenderingContext2D { + return OffscreenCanvasRenderingContext2D{Value: JSValueToValue(js.Global().Get("OffscreenCanvasRenderingContext2D").New(args...))} +} func (o OffscreenCanvasRenderingContext2D) Arc(args ...interface{}) { o.Call("arc", args...) } diff --git a/pagetransitionevent.go b/pagetransitionevent.go index 9d6e53c..fde232d 100644 --- a/pagetransitionevent.go +++ b/pagetransitionevent.go @@ -33,9 +33,12 @@ type PageTransitionEvent struct { } func JSValueToPageTransitionEvent(val js.Value) PageTransitionEvent { - return PageTransitionEvent{Value: Value{Value: val}} + return PageTransitionEvent{Value: JSValueToValue(val)} } func (v Value) AsPageTransitionEvent() PageTransitionEvent { return PageTransitionEvent{Value: v} } +func NewPageTransitionEvent(args ...interface{}) PageTransitionEvent { + return PageTransitionEvent{Value: JSValueToValue(js.Global().Get("PageTransitionEvent").New(args...))} +} func (p PageTransitionEvent) GetPersisted() bool { val := p.Get("persisted") return val.Bool() diff --git a/path2d.go b/path2d.go index aad25c1..fcb8677 100644 --- a/path2d.go +++ b/path2d.go @@ -20,8 +20,11 @@ type Path2D struct { Value } -func JSValueToPath2D(val js.Value) Path2D { return Path2D{Value: Value{Value: val}} } +func JSValueToPath2D(val js.Value) Path2D { return Path2D{Value: JSValueToValue(val)} } func (v Value) AsPath2D() Path2D { return Path2D{Value: v} } +func NewPath2D(args ...interface{}) Path2D { + return Path2D{Value: JSValueToValue(js.Global().Get("Path2D").New(args...))} +} func (p Path2D) AddPath(args ...interface{}) { p.Call("addPath", args...) } diff --git a/performance.go b/performance.go index 3051ff5..016891e 100644 --- a/performance.go +++ b/performance.go @@ -17,8 +17,11 @@ type Performance struct { EventTarget } -func JSValueToPerformance(val js.Value) Performance { return Performance{Value: Value{Value: val}} } +func JSValueToPerformance(val js.Value) Performance { return Performance{Value: JSValueToValue(val)} } func (v Value) AsPerformance() Performance { return Performance{Value: v} } +func NewPerformance(args ...interface{}) Performance { + return Performance{Value: JSValueToValue(js.Global().Get("Performance").New(args...))} +} func (p Performance) Now(args ...interface{}) DOMHighResTimeStamp { val := p.Call("now", args...) return JSValueToDOMHighResTimeStamp(val.JSValue()) diff --git a/plugin.go b/plugin.go index 20ccc41..9a2a490 100644 --- a/plugin.go +++ b/plugin.go @@ -16,8 +16,11 @@ type Plugin struct { Value } -func JSValueToPlugin(val js.Value) Plugin { return Plugin{Value: Value{Value: val}} } +func JSValueToPlugin(val js.Value) Plugin { return Plugin{Value: JSValueToValue(val)} } func (v Value) AsPlugin() Plugin { return Plugin{Value: v} } +func NewPlugin(args ...interface{}) Plugin { + return Plugin{Value: JSValueToValue(js.Global().Get("Plugin").New(args...))} +} func (p Plugin) GetDescription() string { val := p.Get("description") return val.String() diff --git a/pluginarray.go b/pluginarray.go index 80e9027..045cf2a 100644 --- a/pluginarray.go +++ b/pluginarray.go @@ -14,8 +14,11 @@ type PluginArray struct { Value } -func JSValueToPluginArray(val js.Value) PluginArray { return PluginArray{Value: Value{Value: val}} } +func JSValueToPluginArray(val js.Value) PluginArray { return PluginArray{Value: JSValueToValue(val)} } func (v Value) AsPluginArray() PluginArray { return PluginArray{Value: v} } +func NewPluginArray(args ...interface{}) PluginArray { + return PluginArray{Value: JSValueToValue(js.Global().Get("PluginArray").New(args...))} +} func (p PluginArray) Item(args ...interface{}) Plugin { val := p.Call("item", args...) return JSValueToPlugin(val.JSValue()) diff --git a/popstateevent.go b/popstateevent.go index 0cabefc..b47aa5d 100644 --- a/popstateevent.go +++ b/popstateevent.go @@ -33,9 +33,12 @@ type PopStateEvent struct { } func JSValueToPopStateEvent(val js.Value) PopStateEvent { - return PopStateEvent{Value: Value{Value: val}} + return PopStateEvent{Value: JSValueToValue(val)} } func (v Value) AsPopStateEvent() PopStateEvent { return PopStateEvent{Value: v} } +func NewPopStateEvent(args ...interface{}) PopStateEvent { + return PopStateEvent{Value: JSValueToValue(js.Global().Get("PopStateEvent").New(args...))} +} func (p PopStateEvent) GetState() Value { val := p.Get("state") return val diff --git a/processinginstruction.go b/processinginstruction.go index 3410967..607ac56 100644 --- a/processinginstruction.go +++ b/processinginstruction.go @@ -58,9 +58,12 @@ type ProcessingInstruction struct { } func JSValueToProcessingInstruction(val js.Value) ProcessingInstruction { - return ProcessingInstruction{Value: Value{Value: val}} + return ProcessingInstruction{Value: JSValueToValue(val)} } func (v Value) AsProcessingInstruction() ProcessingInstruction { return ProcessingInstruction{Value: v} } +func NewProcessingInstruction(args ...interface{}) ProcessingInstruction { + return ProcessingInstruction{Value: JSValueToValue(js.Global().Get("ProcessingInstruction").New(args...))} +} func (p ProcessingInstruction) GetSheet() StyleSheet { val := p.Get("sheet") return JSValueToStyleSheet(val.JSValue()) diff --git a/progressevent.go b/progressevent.go index 6ef2008..618fb2f 100644 --- a/progressevent.go +++ b/progressevent.go @@ -35,9 +35,12 @@ type ProgressEvent struct { } func JSValueToProgressEvent(val js.Value) ProgressEvent { - return ProgressEvent{Value: Value{Value: val}} + return ProgressEvent{Value: JSValueToValue(val)} } func (v Value) AsProgressEvent() ProgressEvent { return ProgressEvent{Value: v} } +func NewProgressEvent(args ...interface{}) ProgressEvent { + return ProgressEvent{Value: JSValueToValue(js.Global().Get("ProgressEvent").New(args...))} +} func (p ProgressEvent) GetLengthComputable() bool { val := p.Get("lengthComputable") return val.Bool() diff --git a/promiserejectionevent.go b/promiserejectionevent.go index 940c778..019c778 100644 --- a/promiserejectionevent.go +++ b/promiserejectionevent.go @@ -34,9 +34,12 @@ type PromiseRejectionEvent struct { } func JSValueToPromiseRejectionEvent(val js.Value) PromiseRejectionEvent { - return PromiseRejectionEvent{Value: Value{Value: val}} + return PromiseRejectionEvent{Value: JSValueToValue(val)} } func (v Value) AsPromiseRejectionEvent() PromiseRejectionEvent { return PromiseRejectionEvent{Value: v} } +func NewPromiseRejectionEvent(args ...interface{}) PromiseRejectionEvent { + return PromiseRejectionEvent{Value: JSValueToValue(js.Global().Get("PromiseRejectionEvent").New(args...))} +} func (p PromiseRejectionEvent) GetPromise() Value { val := p.Get("promise") return val diff --git a/radionodelist.go b/radionodelist.go index 7c26830..27746a2 100644 --- a/radionodelist.go +++ b/radionodelist.go @@ -16,9 +16,12 @@ type RadioNodeList struct { } func JSValueToRadioNodeList(val js.Value) RadioNodeList { - return RadioNodeList{Value: Value{Value: val}} + return RadioNodeList{Value: JSValueToValue(val)} } func (v Value) AsRadioNodeList() RadioNodeList { return RadioNodeList{Value: v} } +func NewRadioNodeList(args ...interface{}) RadioNodeList { + return RadioNodeList{Value: JSValueToValue(js.Global().Get("RadioNodeList").New(args...))} +} func (r RadioNodeList) GetValue() string { val := r.Get("value") return val.String() diff --git a/range.go b/range.go index 158a225..feb7a72 100644 --- a/range.go +++ b/range.go @@ -38,8 +38,11 @@ type Range struct { AbstractRange } -func JSValueToRange(val js.Value) Range { return Range{Value: Value{Value: val}} } +func JSValueToRange(val js.Value) Range { return Range{Value: JSValueToValue(val)} } func (v Value) AsRange() Range { return Range{Value: v} } +func NewRange(args ...interface{}) Range { + return Range{Value: JSValueToValue(js.Global().Get("Range").New(args...))} +} func (r Range) CloneContents(args ...interface{}) DocumentFragment { val := r.Call("cloneContents", args...) return JSValueToDocumentFragment(val.JSValue()) diff --git a/request.go b/request.go index 5c46b8d..4ce4935 100644 --- a/request.go +++ b/request.go @@ -33,8 +33,11 @@ type Request struct { Value } -func JSValueToRequest(val js.Value) Request { return Request{Value: Value{Value: val}} } +func JSValueToRequest(val js.Value) Request { return Request{Value: JSValueToValue(val)} } func (v Value) AsRequest() Request { return Request{Value: v} } +func NewRequest(args ...interface{}) Request { + return Request{Value: JSValueToValue(js.Global().Get("Request").New(args...))} +} func (r Request) ArrayBuffer(args ...interface{}) { r.Call("arrayBuffer", args...) } diff --git a/response.go b/response.go index 87ff001..96ec2c6 100644 --- a/response.go +++ b/response.go @@ -28,8 +28,11 @@ type Response struct { Value } -func JSValueToResponse(val js.Value) Response { return Response{Value: Value{Value: val}} } +func JSValueToResponse(val js.Value) Response { return Response{Value: JSValueToValue(val)} } func (v Value) AsResponse() Response { return Response{Value: v} } +func NewResponse(args ...interface{}) Response { + return Response{Value: JSValueToValue(js.Global().Get("Response").New(args...))} +} func (r Response) ArrayBuffer(args ...interface{}) { r.Call("arrayBuffer", args...) } diff --git a/shadowroot.go b/shadowroot.go index 025f3d0..8832d6d 100644 --- a/shadowroot.go +++ b/shadowroot.go @@ -49,8 +49,11 @@ type ShadowRoot struct { EventTarget } -func JSValueToShadowRoot(val js.Value) ShadowRoot { return ShadowRoot{Value: Value{Value: val}} } +func JSValueToShadowRoot(val js.Value) ShadowRoot { return ShadowRoot{Value: JSValueToValue(val)} } func (v Value) AsShadowRoot() ShadowRoot { return ShadowRoot{Value: v} } +func NewShadowRoot(args ...interface{}) ShadowRoot { + return ShadowRoot{Value: JSValueToValue(js.Global().Get("ShadowRoot").New(args...))} +} func (s ShadowRoot) GetHost() Element { val := s.Get("host") return JSValueToElement(val.JSValue()) diff --git a/sharedworker.go b/sharedworker.go index 3e87212..86dff27 100644 --- a/sharedworker.go +++ b/sharedworker.go @@ -17,8 +17,11 @@ type SharedWorker struct { EventTarget } -func JSValueToSharedWorker(val js.Value) SharedWorker { return SharedWorker{Value: Value{Value: val}} } +func JSValueToSharedWorker(val js.Value) SharedWorker { return SharedWorker{Value: JSValueToValue(val)} } func (v Value) AsSharedWorker() SharedWorker { return SharedWorker{Value: v} } +func NewSharedWorker(args ...interface{}) SharedWorker { + return SharedWorker{Value: JSValueToValue(js.Global().Get("SharedWorker").New(args...))} +} func (s SharedWorker) GetOnerror() EventHandler { val := s.Get("onerror") return JSValueToEventHandler(val.JSValue()) diff --git a/sharedworkerglobalscope.go b/sharedworkerglobalscope.go index 6f75b9a..06bd9c2 100644 --- a/sharedworkerglobalscope.go +++ b/sharedworkerglobalscope.go @@ -36,11 +36,14 @@ type SharedWorkerGlobalScope struct { } func JSValueToSharedWorkerGlobalScope(val js.Value) SharedWorkerGlobalScope { - return SharedWorkerGlobalScope{Value: Value{Value: val}} + return SharedWorkerGlobalScope{Value: JSValueToValue(val)} } func (v Value) AsSharedWorkerGlobalScope() SharedWorkerGlobalScope { return SharedWorkerGlobalScope{Value: v} } +func NewSharedWorkerGlobalScope(args ...interface{}) SharedWorkerGlobalScope { + return SharedWorkerGlobalScope{Value: JSValueToValue(js.Global().Get("SharedWorkerGlobalScope").New(args...))} +} func (s SharedWorkerGlobalScope) Close(args ...interface{}) { s.Call("close", args...) } diff --git a/staticrange.go b/staticrange.go index 829cf18..26ad051 100644 --- a/staticrange.go +++ b/staticrange.go @@ -16,5 +16,8 @@ type StaticRange struct { AbstractRange } -func JSValueToStaticRange(val js.Value) StaticRange { return StaticRange{Value: Value{Value: val}} } +func JSValueToStaticRange(val js.Value) StaticRange { return StaticRange{Value: JSValueToValue(val)} } func (v Value) AsStaticRange() StaticRange { return StaticRange{Value: v} } +func NewStaticRange(args ...interface{}) StaticRange { + return StaticRange{Value: JSValueToValue(js.Global().Get("StaticRange").New(args...))} +} diff --git a/storage.go b/storage.go index 4fbc1ec..54d50fb 100644 --- a/storage.go +++ b/storage.go @@ -16,8 +16,11 @@ type Storage struct { Value } -func JSValueToStorage(val js.Value) Storage { return Storage{Value: Value{Value: val}} } +func JSValueToStorage(val js.Value) Storage { return Storage{Value: JSValueToValue(val)} } func (v Value) AsStorage() Storage { return Storage{Value: v} } +func NewStorage(args ...interface{}) Storage { + return Storage{Value: JSValueToValue(js.Global().Get("Storage").New(args...))} +} func (s Storage) Clear(args ...interface{}) { s.Call("clear", args...) } diff --git a/storageevent.go b/storageevent.go index 1ffa4af..56f81eb 100644 --- a/storageevent.go +++ b/storageevent.go @@ -36,8 +36,11 @@ type StorageEvent struct { Event } -func JSValueToStorageEvent(val js.Value) StorageEvent { return StorageEvent{Value: Value{Value: val}} } +func JSValueToStorageEvent(val js.Value) StorageEvent { return StorageEvent{Value: JSValueToValue(val)} } func (v Value) AsStorageEvent() StorageEvent { return StorageEvent{Value: v} } +func NewStorageEvent(args ...interface{}) StorageEvent { + return StorageEvent{Value: JSValueToValue(js.Global().Get("StorageEvent").New(args...))} +} func (s StorageEvent) GetKey() string { val := s.Get("key") return val.String() diff --git a/storagemanager.go b/storagemanager.go index 4cd54a9..73426cd 100644 --- a/storagemanager.go +++ b/storagemanager.go @@ -14,9 +14,12 @@ type StorageManager struct { } func JSValueToStorageManager(val js.Value) StorageManager { - return StorageManager{Value: Value{Value: val}} + return StorageManager{Value: JSValueToValue(val)} } func (v Value) AsStorageManager() StorageManager { return StorageManager{Value: v} } +func NewStorageManager(args ...interface{}) StorageManager { + return StorageManager{Value: JSValueToValue(js.Global().Get("StorageManager").New(args...))} +} func (s StorageManager) Estimate(args ...interface{}) { s.Call("estimate", args...) } diff --git a/stylesheet.go b/stylesheet.go index 88c7be4..3b5e27d 100644 --- a/stylesheet.go +++ b/stylesheet.go @@ -18,8 +18,11 @@ type StyleSheet struct { Value } -func JSValueToStyleSheet(val js.Value) StyleSheet { return StyleSheet{Value: Value{Value: val}} } +func JSValueToStyleSheet(val js.Value) StyleSheet { return StyleSheet{Value: JSValueToValue(val)} } func (v Value) AsStyleSheet() StyleSheet { return StyleSheet{Value: v} } +func NewStyleSheet(args ...interface{}) StyleSheet { + return StyleSheet{Value: JSValueToValue(js.Global().Get("StyleSheet").New(args...))} +} func (s StyleSheet) GetDisabled() bool { val := s.Get("disabled") return val.Bool() diff --git a/stylesheetlist.go b/stylesheetlist.go index 6f9ab5e..8942be1 100644 --- a/stylesheetlist.go +++ b/stylesheetlist.go @@ -13,9 +13,12 @@ type StyleSheetList struct { } func JSValueToStyleSheetList(val js.Value) StyleSheetList { - return StyleSheetList{Value: Value{Value: val}} + return StyleSheetList{Value: JSValueToValue(val)} } func (v Value) AsStyleSheetList() StyleSheetList { return StyleSheetList{Value: v} } +func NewStyleSheetList(args ...interface{}) StyleSheetList { + return StyleSheetList{Value: JSValueToValue(js.Global().Get("StyleSheetList").New(args...))} +} func (s StyleSheetList) Item(args ...interface{}) StyleSheet { val := s.Call("item", args...) return JSValueToStyleSheet(val.JSValue()) diff --git a/text.go b/text.go index a020a6f..aa21ca0 100644 --- a/text.go +++ b/text.go @@ -58,8 +58,11 @@ type Text struct { EventTarget } -func JSValueToText(val js.Value) Text { return Text{Value: Value{Value: val}} } +func JSValueToText(val js.Value) Text { return Text{Value: JSValueToValue(val)} } func (v Value) AsText() Text { return Text{Value: v} } +func NewText(args ...interface{}) Text { + return Text{Value: JSValueToValue(js.Global().Get("Text").New(args...))} +} func (t Text) GetAssignedSlot() HTMLSlotElement { val := t.Get("assignedSlot") return JSValueToHTMLSlotElement(val.JSValue()) diff --git a/textdecoder.go b/textdecoder.go index c6b73e2..bd4f032 100644 --- a/textdecoder.go +++ b/textdecoder.go @@ -14,8 +14,11 @@ type TextDecoder struct { Value } -func JSValueToTextDecoder(val js.Value) TextDecoder { return TextDecoder{Value: Value{Value: val}} } +func JSValueToTextDecoder(val js.Value) TextDecoder { return TextDecoder{Value: JSValueToValue(val)} } func (v Value) AsTextDecoder() TextDecoder { return TextDecoder{Value: v} } +func NewTextDecoder(args ...interface{}) TextDecoder { + return TextDecoder{Value: JSValueToValue(js.Global().Get("TextDecoder").New(args...))} +} func (t TextDecoder) Decode(args ...interface{}) string { val := t.Call("decode", args...) return val.String() diff --git a/textdecoderstream.go b/textdecoderstream.go index aa885d0..d51088c 100644 --- a/textdecoderstream.go +++ b/textdecoderstream.go @@ -16,9 +16,12 @@ type TextDecoderStream struct { } func JSValueToTextDecoderStream(val js.Value) TextDecoderStream { - return TextDecoderStream{Value: Value{Value: val}} + return TextDecoderStream{Value: JSValueToValue(val)} } func (v Value) AsTextDecoderStream() TextDecoderStream { return TextDecoderStream{Value: v} } +func NewTextDecoderStream(args ...interface{}) TextDecoderStream { + return TextDecoderStream{Value: JSValueToValue(js.Global().Get("TextDecoderStream").New(args...))} +} func (t TextDecoderStream) GetEncoding() string { val := t.Get("encoding") return val.String() diff --git a/textencoder.go b/textencoder.go index 1f165b8..35d984d 100644 --- a/textencoder.go +++ b/textencoder.go @@ -12,8 +12,11 @@ type TextEncoder struct { Value } -func JSValueToTextEncoder(val js.Value) TextEncoder { return TextEncoder{Value: Value{Value: val}} } +func JSValueToTextEncoder(val js.Value) TextEncoder { return TextEncoder{Value: JSValueToValue(val)} } func (v Value) AsTextEncoder() TextEncoder { return TextEncoder{Value: v} } +func NewTextEncoder(args ...interface{}) TextEncoder { + return TextEncoder{Value: JSValueToValue(js.Global().Get("TextEncoder").New(args...))} +} func (t TextEncoder) Encode(args ...interface{}) Uint8Array { val := t.Call("encode", args...) return JSValueToUint8Array(val.JSValue()) diff --git a/textencoderstream.go b/textencoderstream.go index 335e64e..85015b4 100644 --- a/textencoderstream.go +++ b/textencoderstream.go @@ -14,9 +14,12 @@ type TextEncoderStream struct { } func JSValueToTextEncoderStream(val js.Value) TextEncoderStream { - return TextEncoderStream{Value: Value{Value: val}} + return TextEncoderStream{Value: JSValueToValue(val)} } func (v Value) AsTextEncoderStream() TextEncoderStream { return TextEncoderStream{Value: v} } +func NewTextEncoderStream(args ...interface{}) TextEncoderStream { + return TextEncoderStream{Value: JSValueToValue(js.Global().Get("TextEncoderStream").New(args...))} +} func (t TextEncoderStream) GetEncoding() string { val := t.Get("encoding") return val.String() diff --git a/textmetrics.go b/textmetrics.go index c31e8c7..02df97d 100644 --- a/textmetrics.go +++ b/textmetrics.go @@ -22,8 +22,11 @@ type TextMetrics struct { Value } -func JSValueToTextMetrics(val js.Value) TextMetrics { return TextMetrics{Value: Value{Value: val}} } +func JSValueToTextMetrics(val js.Value) TextMetrics { return TextMetrics{Value: JSValueToValue(val)} } func (v Value) AsTextMetrics() TextMetrics { return TextMetrics{Value: v} } +func NewTextMetrics(args ...interface{}) TextMetrics { + return TextMetrics{Value: JSValueToValue(js.Global().Get("TextMetrics").New(args...))} +} func (t TextMetrics) GetActualBoundingBoxAscent() float64 { val := t.Get("actualBoundingBoxAscent") return val.Float() diff --git a/texttrack.go b/texttrack.go index f27e6ca..5a9831f 100644 --- a/texttrack.go +++ b/texttrack.go @@ -27,8 +27,11 @@ type TextTrack struct { EventTarget } -func JSValueToTextTrack(val js.Value) TextTrack { return TextTrack{Value: Value{Value: val}} } +func JSValueToTextTrack(val js.Value) TextTrack { return TextTrack{Value: JSValueToValue(val)} } func (v Value) AsTextTrack() TextTrack { return TextTrack{Value: v} } +func NewTextTrack(args ...interface{}) TextTrack { + return TextTrack{Value: JSValueToValue(js.Global().Get("TextTrack").New(args...))} +} func (t TextTrack) GetActiveCues() TextTrackCueList { val := t.Get("activeCues") return JSValueToTextTrackCueList(val.JSValue()) diff --git a/texttrackcue.go b/texttrackcue.go index 399e8f2..f06af91 100644 --- a/texttrackcue.go +++ b/texttrackcue.go @@ -27,8 +27,11 @@ type TextTrackCue struct { EventTarget } -func JSValueToTextTrackCue(val js.Value) TextTrackCue { return TextTrackCue{Value: Value{Value: val}} } +func JSValueToTextTrackCue(val js.Value) TextTrackCue { return TextTrackCue{Value: JSValueToValue(val)} } func (v Value) AsTextTrackCue() TextTrackCue { return TextTrackCue{Value: v} } +func NewTextTrackCue(args ...interface{}) TextTrackCue { + return TextTrackCue{Value: JSValueToValue(js.Global().Get("TextTrackCue").New(args...))} +} func (t TextTrackCue) GetEndTime() float64 { val := t.Get("endTime") return val.Float() diff --git a/texttrackcuelist.go b/texttrackcuelist.go index 9275202..e62535e 100644 --- a/texttrackcuelist.go +++ b/texttrackcuelist.go @@ -13,9 +13,12 @@ type TextTrackCueList struct { } func JSValueToTextTrackCueList(val js.Value) TextTrackCueList { - return TextTrackCueList{Value: Value{Value: val}} + return TextTrackCueList{Value: JSValueToValue(val)} } func (v Value) AsTextTrackCueList() TextTrackCueList { return TextTrackCueList{Value: v} } +func NewTextTrackCueList(args ...interface{}) TextTrackCueList { + return TextTrackCueList{Value: JSValueToValue(js.Global().Get("TextTrackCueList").New(args...))} +} func (t TextTrackCueList) GetCueById(args ...interface{}) TextTrackCue { val := t.Call("getCueById", args...) return JSValueToTextTrackCue(val.JSValue()) diff --git a/texttracklist.go b/texttracklist.go index ab1ad16..8534ad5 100644 --- a/texttracklist.go +++ b/texttracklist.go @@ -23,9 +23,12 @@ type TextTrackList struct { } func JSValueToTextTrackList(val js.Value) TextTrackList { - return TextTrackList{Value: Value{Value: val}} + return TextTrackList{Value: JSValueToValue(val)} } func (v Value) AsTextTrackList() TextTrackList { return TextTrackList{Value: v} } +func NewTextTrackList(args ...interface{}) TextTrackList { + return TextTrackList{Value: JSValueToValue(js.Global().Get("TextTrackList").New(args...))} +} func (t TextTrackList) GetTrackById(args ...interface{}) TextTrack { val := t.Call("getTrackById", args...) return JSValueToTextTrack(val.JSValue()) diff --git a/timeranges.go b/timeranges.go index 9f2aaf4..85f12f4 100644 --- a/timeranges.go +++ b/timeranges.go @@ -13,8 +13,11 @@ type TimeRanges struct { Value } -func JSValueToTimeRanges(val js.Value) TimeRanges { return TimeRanges{Value: Value{Value: val}} } +func JSValueToTimeRanges(val js.Value) TimeRanges { return TimeRanges{Value: JSValueToValue(val)} } func (v Value) AsTimeRanges() TimeRanges { return TimeRanges{Value: v} } +func NewTimeRanges(args ...interface{}) TimeRanges { + return TimeRanges{Value: JSValueToValue(js.Global().Get("TimeRanges").New(args...))} +} func (t TimeRanges) End(args ...interface{}) float64 { val := t.Call("end", args...) return val.Float() diff --git a/trackevent.go b/trackevent.go index b3ff9b9..b92b2ad 100644 --- a/trackevent.go +++ b/trackevent.go @@ -32,8 +32,11 @@ type TrackEvent struct { Event } -func JSValueToTrackEvent(val js.Value) TrackEvent { return TrackEvent{Value: Value{Value: val}} } +func JSValueToTrackEvent(val js.Value) TrackEvent { return TrackEvent{Value: JSValueToValue(val)} } func (v Value) AsTrackEvent() TrackEvent { return TrackEvent{Value: v} } +func NewTrackEvent(args ...interface{}) TrackEvent { + return TrackEvent{Value: JSValueToValue(js.Global().Get("TrackEvent").New(args...))} +} func (t TrackEvent) GetTrack() Value { val := t.Get("track") return val diff --git a/treewalker.go b/treewalker.go index 1974fe6..8e8f093 100644 --- a/treewalker.go +++ b/treewalker.go @@ -22,8 +22,11 @@ type TreeWalker struct { Value } -func JSValueToTreeWalker(val js.Value) TreeWalker { return TreeWalker{Value: Value{Value: val}} } +func JSValueToTreeWalker(val js.Value) TreeWalker { return TreeWalker{Value: JSValueToValue(val)} } func (v Value) AsTreeWalker() TreeWalker { return TreeWalker{Value: v} } +func NewTreeWalker(args ...interface{}) TreeWalker { + return TreeWalker{Value: JSValueToValue(js.Global().Get("TreeWalker").New(args...))} +} func (t TreeWalker) GetCurrentNode() Node { val := t.Get("currentNode") return JSValueToNode(val.JSValue()) diff --git a/url.go b/url.go index 5193918..8b1c721 100644 --- a/url.go +++ b/url.go @@ -35,8 +35,11 @@ type URL struct { Value } -func JSValueToURL(val js.Value) URL { return URL{Value: Value{Value: val}} } +func JSValueToURL(val js.Value) URL { return URL{Value: JSValueToValue(val)} } func (v Value) AsURL() URL { return URL{Value: v} } +func NewURL(args ...interface{}) URL { + return URL{Value: JSValueToValue(js.Global().Get("URL").New(args...))} +} func (u URL) CreateObjectURL(args ...interface{}) string { val := u.Call("createObjectURL", args...) return val.String() diff --git a/urlsearchparams.go b/urlsearchparams.go index 88fca36..2dc0706 100644 --- a/urlsearchparams.go +++ b/urlsearchparams.go @@ -18,9 +18,12 @@ type URLSearchParams struct { } func JSValueToURLSearchParams(val js.Value) URLSearchParams { - return URLSearchParams{Value: Value{Value: val}} + return URLSearchParams{Value: JSValueToValue(val)} } func (v Value) AsURLSearchParams() URLSearchParams { return URLSearchParams{Value: v} } +func NewURLSearchParams(args ...interface{}) URLSearchParams { + return URLSearchParams{Value: JSValueToValue(js.Global().Get("URLSearchParams").New(args...))} +} func (u URLSearchParams) Append(args ...interface{}) { u.Call("append", args...) } diff --git a/validitystate.go b/validitystate.go index 9753c68..7669f04 100644 --- a/validitystate.go +++ b/validitystate.go @@ -22,9 +22,12 @@ type ValidityState struct { } func JSValueToValidityState(val js.Value) ValidityState { - return ValidityState{Value: Value{Value: val}} + return ValidityState{Value: JSValueToValue(val)} } func (v Value) AsValidityState() ValidityState { return ValidityState{Value: v} } +func NewValidityState(args ...interface{}) ValidityState { + return ValidityState{Value: JSValueToValue(js.Global().Get("ValidityState").New(args...))} +} func (v ValidityState) GetBadInput() bool { val := v.Get("badInput") return val.Bool() diff --git a/videotrack.go b/videotrack.go index e8eea0f..a37cf98 100644 --- a/videotrack.go +++ b/videotrack.go @@ -16,8 +16,11 @@ type VideoTrack struct { Value } -func JSValueToVideoTrack(val js.Value) VideoTrack { return VideoTrack{Value: Value{Value: val}} } +func JSValueToVideoTrack(val js.Value) VideoTrack { return VideoTrack{Value: JSValueToValue(val)} } func (v Value) AsVideoTrack() VideoTrack { return VideoTrack{Value: v} } +func NewVideoTrack(args ...interface{}) VideoTrack { + return VideoTrack{Value: JSValueToValue(js.Global().Get("VideoTrack").New(args...))} +} func (v VideoTrack) GetId() string { val := v.Get("id") return val.String() diff --git a/videotracklist.go b/videotracklist.go index 3ec5a39..80e673e 100644 --- a/videotracklist.go +++ b/videotracklist.go @@ -24,9 +24,12 @@ type VideoTrackList struct { } func JSValueToVideoTrackList(val js.Value) VideoTrackList { - return VideoTrackList{Value: Value{Value: val}} + return VideoTrackList{Value: JSValueToValue(val)} } func (v Value) AsVideoTrackList() VideoTrackList { return VideoTrackList{Value: v} } +func NewVideoTrackList(args ...interface{}) VideoTrackList { + return VideoTrackList{Value: JSValueToValue(js.Global().Get("VideoTrackList").New(args...))} +} func (v VideoTrackList) GetTrackById(args ...interface{}) VideoTrack { val := v.Call("getTrackById", args...) return JSValueToVideoTrack(val.JSValue()) diff --git a/websocket.go b/websocket.go index 4545263..d7a1239 100644 --- a/websocket.go +++ b/websocket.go @@ -34,8 +34,11 @@ type WebSocket struct { EventTarget } -func JSValueToWebSocket(val js.Value) WebSocket { return WebSocket{Value: Value{Value: val}} } +func JSValueToWebSocket(val js.Value) WebSocket { return WebSocket{Value: JSValueToValue(val)} } func (v Value) AsWebSocket() WebSocket { return WebSocket{Value: v} } +func NewWebSocket(args ...interface{}) WebSocket { + return WebSocket{Value: JSValueToValue(js.Global().Get("WebSocket").New(args...))} +} func (w WebSocket) GetBinaryType() BinaryType { val := w.Get("binaryType") return JSValueToBinaryType(val.JSValue()) diff --git a/window.go b/window.go index 1652a56..21915c0 100644 --- a/window.go +++ b/window.go @@ -226,8 +226,11 @@ type Window struct { EventTarget } -func JSValueToWindow(val js.Value) Window { return Window{Value: Value{Value: val}} } +func JSValueToWindow(val js.Value) Window { return Window{Value: JSValueToValue(val)} } func (v Value) AsWindow() Window { return Window{Value: v} } +func NewWindow(args ...interface{}) Window { + return Window{Value: JSValueToValue(js.Global().Get("Window").New(args...))} +} func (w Window) Alert(args ...interface{}) { w.Call("alert", args...) } diff --git a/worker.go b/worker.go index 254c631..8a6db4d 100644 --- a/worker.go +++ b/worker.go @@ -22,8 +22,11 @@ type Worker struct { EventTarget } -func JSValueToWorker(val js.Value) Worker { return Worker{Value: Value{Value: val}} } +func JSValueToWorker(val js.Value) Worker { return Worker{Value: JSValueToValue(val)} } func (v Value) AsWorker() Worker { return Worker{Value: v} } +func NewWorker(args ...interface{}) Worker { + return Worker{Value: JSValueToValue(js.Global().Get("Worker").New(args...))} +} func (w Worker) GetOnerror() EventHandler { val := w.Get("onerror") return JSValueToEventHandler(val.JSValue()) diff --git a/workerglobalscope.go b/workerglobalscope.go index 0419f6a..743f773 100644 --- a/workerglobalscope.go +++ b/workerglobalscope.go @@ -41,9 +41,12 @@ type WorkerGlobalScope struct { } func JSValueToWorkerGlobalScope(val js.Value) WorkerGlobalScope { - return WorkerGlobalScope{Value: Value{Value: val}} + return WorkerGlobalScope{Value: JSValueToValue(val)} } func (v Value) AsWorkerGlobalScope() WorkerGlobalScope { return WorkerGlobalScope{Value: v} } +func NewWorkerGlobalScope(args ...interface{}) WorkerGlobalScope { + return WorkerGlobalScope{Value: JSValueToValue(js.Global().Get("WorkerGlobalScope").New(args...))} +} func (w WorkerGlobalScope) Atob(args ...interface{}) []byte { val := w.Call("atob", args...) return []byte(val.String()) diff --git a/workerlocation.go b/workerlocation.go index a83713c..0f1af85 100644 --- a/workerlocation.go +++ b/workerlocation.go @@ -20,9 +20,12 @@ type WorkerLocation struct { } func JSValueToWorkerLocation(val js.Value) WorkerLocation { - return WorkerLocation{Value: Value{Value: val}} + return WorkerLocation{Value: JSValueToValue(val)} } func (v Value) AsWorkerLocation() WorkerLocation { return WorkerLocation{Value: v} } +func NewWorkerLocation(args ...interface{}) WorkerLocation { + return WorkerLocation{Value: JSValueToValue(js.Global().Get("WorkerLocation").New(args...))} +} func (w WorkerLocation) GetHash() string { val := w.Get("hash") return val.String() diff --git a/workernavigator.go b/workernavigator.go index 97564c6..6c4b729 100644 --- a/workernavigator.go +++ b/workernavigator.go @@ -25,9 +25,12 @@ type WorkerNavigator struct { } func JSValueToWorkerNavigator(val js.Value) WorkerNavigator { - return WorkerNavigator{Value: Value{Value: val}} + return WorkerNavigator{Value: JSValueToValue(val)} } func (v Value) AsWorkerNavigator() WorkerNavigator { return WorkerNavigator{Value: v} } +func NewWorkerNavigator(args ...interface{}) WorkerNavigator { + return WorkerNavigator{Value: JSValueToValue(js.Global().Get("WorkerNavigator").New(args...))} +} func (w WorkerNavigator) GetAppCodeName() string { val := w.Get("appCodeName") return val.String() diff --git a/xmldocument.go b/xmldocument.go index 524626d..10669d9 100644 --- a/xmldocument.go +++ b/xmldocument.go @@ -76,5 +76,8 @@ type XMLDocument struct { EventTarget } -func JSValueToXMLDocument(val js.Value) XMLDocument { return XMLDocument{Value: Value{Value: val}} } +func JSValueToXMLDocument(val js.Value) XMLDocument { return XMLDocument{Value: JSValueToValue(val)} } func (v Value) AsXMLDocument() XMLDocument { return XMLDocument{Value: v} } +func NewXMLDocument(args ...interface{}) XMLDocument { + return XMLDocument{Value: JSValueToValue(js.Global().Get("XMLDocument").New(args...))} +} diff --git a/xmlhttprequest.go b/xmlhttprequest.go index a5a7fdb..a9c6a9d 100644 --- a/xmlhttprequest.go +++ b/xmlhttprequest.go @@ -54,9 +54,12 @@ type XMLHttpRequest struct { } func JSValueToXMLHttpRequest(val js.Value) XMLHttpRequest { - return XMLHttpRequest{Value: Value{Value: val}} + return XMLHttpRequest{Value: JSValueToValue(val)} } func (v Value) AsXMLHttpRequest() XMLHttpRequest { return XMLHttpRequest{Value: v} } +func NewXMLHttpRequest(args ...interface{}) XMLHttpRequest { + return XMLHttpRequest{Value: JSValueToValue(js.Global().Get("XMLHttpRequest").New(args...))} +} func (x XMLHttpRequest) Abort(args ...interface{}) { x.Call("abort", args...) } diff --git a/xmlhttprequesteventtarget.go b/xmlhttprequesteventtarget.go index 8d964b3..3b4f802 100644 --- a/xmlhttprequesteventtarget.go +++ b/xmlhttprequesteventtarget.go @@ -29,11 +29,14 @@ type XMLHttpRequestEventTarget struct { } func JSValueToXMLHttpRequestEventTarget(val js.Value) XMLHttpRequestEventTarget { - return XMLHttpRequestEventTarget{Value: Value{Value: val}} + return XMLHttpRequestEventTarget{Value: JSValueToValue(val)} } func (v Value) AsXMLHttpRequestEventTarget() XMLHttpRequestEventTarget { return XMLHttpRequestEventTarget{Value: v} } +func NewXMLHttpRequestEventTarget(args ...interface{}) XMLHttpRequestEventTarget { + return XMLHttpRequestEventTarget{Value: JSValueToValue(js.Global().Get("XMLHttpRequestEventTarget").New(args...))} +} func (x XMLHttpRequestEventTarget) GetOnabort() EventHandler { val := x.Get("onabort") return JSValueToEventHandler(val.JSValue()) diff --git a/xmlhttprequestupload.go b/xmlhttprequestupload.go index 4fd3018..e84ad49 100644 --- a/xmlhttprequestupload.go +++ b/xmlhttprequestupload.go @@ -30,6 +30,9 @@ type XMLHttpRequestUpload struct { } func JSValueToXMLHttpRequestUpload(val js.Value) XMLHttpRequestUpload { - return XMLHttpRequestUpload{Value: Value{Value: val}} + return XMLHttpRequestUpload{Value: JSValueToValue(val)} } func (v Value) AsXMLHttpRequestUpload() XMLHttpRequestUpload { return XMLHttpRequestUpload{Value: v} } +func NewXMLHttpRequestUpload(args ...interface{}) XMLHttpRequestUpload { + return XMLHttpRequestUpload{Value: JSValueToValue(js.Global().Get("XMLHttpRequestUpload").New(args...))} +} diff --git a/xmlserializer.go b/xmlserializer.go index 1066f22..01fa464 100644 --- a/xmlserializer.go +++ b/xmlserializer.go @@ -12,9 +12,12 @@ type XMLSerializer struct { } func JSValueToXMLSerializer(val js.Value) XMLSerializer { - return XMLSerializer{Value: Value{Value: val}} + return XMLSerializer{Value: JSValueToValue(val)} } func (v Value) AsXMLSerializer() XMLSerializer { return XMLSerializer{Value: v} } +func NewXMLSerializer(args ...interface{}) XMLSerializer { + return XMLSerializer{Value: JSValueToValue(js.Global().Get("XMLSerializer").New(args...))} +} func (x XMLSerializer) SerializeToString(args ...interface{}) string { val := x.Call("serializeToString", args...) return val.String()