diff --git a/abstractrange.go b/abstractrange.go index ad6b12f..042aa15 100644 --- a/abstractrange.go +++ b/abstractrange.go @@ -7,9 +7,9 @@ import "syscall/js" type AbstractRangeIFace interface { GetCollapsed() bool GetEndContainer() Node - GetEndOffset() float64 + GetEndOffset() int GetStartContainer() Node - GetStartOffset() float64 + GetStartOffset() int } type AbstractRange struct { Value @@ -27,15 +27,15 @@ func (a AbstractRange) GetEndContainer() Node { val := a.Get("endContainer") return JSValueToNode(val.JSValue()) } -func (a AbstractRange) GetEndOffset() float64 { +func (a AbstractRange) GetEndOffset() int { val := a.Get("endOffset") - return val.Float() + return val.Int() } func (a AbstractRange) GetStartContainer() Node { val := a.Get("startContainer") return JSValueToNode(val.JSValue()) } -func (a AbstractRange) GetStartOffset() float64 { +func (a AbstractRange) GetStartOffset() int { val := a.Get("startOffset") - return val.Float() + return val.Int() } diff --git a/audiotracklist.go b/audiotracklist.go index 78b1b40..d7f6193 100644 --- a/audiotracklist.go +++ b/audiotracklist.go @@ -8,7 +8,7 @@ type AudioTrackListIFace interface { AddEventListener(args ...interface{}) DispatchEvent(args ...interface{}) bool GetTrackById(args ...interface{}) AudioTrack - GetLength() float64 + GetLength() int GetOnaddtrack() EventHandler SetOnaddtrack(EventHandler) GetOnchange() EventHandler @@ -30,9 +30,9 @@ func (a AudioTrackList) GetTrackById(args ...interface{}) AudioTrack { val := a.Call("getTrackById", args...) return JSValueToAudioTrack(val.JSValue()) } -func (a AudioTrackList) GetLength() float64 { +func (a AudioTrackList) GetLength() int { val := a.Get("length") - return val.Float() + return val.Int() } func (a AudioTrackList) GetOnaddtrack() EventHandler { val := a.Get("onaddtrack") diff --git a/blob.go b/blob.go index fd5d09c..0bfd24e 100644 --- a/blob.go +++ b/blob.go @@ -5,7 +5,7 @@ package dom import "syscall/js" type BlobIFace interface { - GetSize() float64 + GetSize() int Slice(args ...interface{}) Blob GetType() string } @@ -15,9 +15,9 @@ type Blob struct { func JSValueToBlob(val js.Value) Blob { return Blob{Value: Value{Value: val}} } func (v Value) AsBlob() Blob { return Blob{Value: v} } -func (b Blob) GetSize() float64 { +func (b Blob) GetSize() int { val := b.Get("size") - return val.Float() + return val.Int() } func (b Blob) Slice(args ...interface{}) Blob { val := b.Call("slice", args...) diff --git a/cdatasection.go b/cdatasection.go index 765a143..00c350f 100644 --- a/cdatasection.go +++ b/cdatasection.go @@ -27,7 +27,7 @@ type CDATASectionIFace interface { IsEqualNode(args ...interface{}) bool IsSameNode(args ...interface{}) bool GetLastChild() Node - GetLength() float64 + GetLength() int LookupNamespaceURI(args ...interface{}) string LookupPrefix(args ...interface{}) string GetNextSibling() Node diff --git a/characterdata.go b/characterdata.go index de07a66..62e8533 100644 --- a/characterdata.go +++ b/characterdata.go @@ -29,7 +29,7 @@ type CharacterDataIFace interface { IsEqualNode(args ...interface{}) bool IsSameNode(args ...interface{}) bool GetLastChild() Node - GetLength() float64 + GetLength() int LookupNamespaceURI(args ...interface{}) string LookupPrefix(args ...interface{}) string GetNextElementSibling() Element @@ -86,9 +86,9 @@ func (c CharacterData) DeleteData(args ...interface{}) { func (c CharacterData) InsertData(args ...interface{}) { c.Call("insertData", args...) } -func (c CharacterData) GetLength() float64 { +func (c CharacterData) GetLength() int { val := c.Get("length") - return val.Float() + return val.Int() } func (c CharacterData) GetNextElementSibling() Element { val := c.Get("nextElementSibling") diff --git a/cmd/dom/main.go b/cmd/dom/main.go index 50fc5ed..6efcc3f 100644 --- a/cmd/dom/main.go +++ b/cmd/dom/main.go @@ -1,18 +1,17 @@ package main import ( - "github.com/brettlangdon/go-dom/v1/console" - "github.com/brettlangdon/go-dom/v1/document" - "github.com/brettlangdon/go-dom/v1/window" + "github.com/brettlangdon/go-dom/console" + "github.com/brettlangdon/go-dom/document" + "github.com/brettlangdon/go-dom/window" ) func main() { loc := window.GetLocation() - console.Dir(loc.JSValue()) + console.Dir(loc) nodes := document.QuerySelectorAll("div") - var i float64 = 0 - for ; i < nodes.GetLength(); i++ { - console.Dir(nodes.Item(i).JSValue()) + for i := 0; i < nodes.GetLength(); i++ { + console.Dir(nodes.Item(i)) } } diff --git a/comment.go b/comment.go index 1707b06..eb0e8f6 100644 --- a/comment.go +++ b/comment.go @@ -27,7 +27,7 @@ type CommentIFace interface { IsEqualNode(args ...interface{}) bool IsSameNode(args ...interface{}) bool GetLastChild() Node - GetLength() float64 + GetLength() int LookupNamespaceURI(args ...interface{}) string LookupPrefix(args ...interface{}) string GetNextSibling() Node diff --git a/console/console.go b/console/console.go index 2d5985e..20b8276 100644 --- a/console/console.go +++ b/console/console.go @@ -2,7 +2,7 @@ // console/console.go package console -import dom "github.com/brettlangdon/go-dom/v1" +import dom "github.com/brettlangdon/go-dom" import "syscall/js" var value dom.Value diff --git a/css/css.go b/css/css.go index ff6d23e..9fd9ea8 100644 --- a/css/css.go +++ b/css/css.go @@ -2,7 +2,7 @@ // css/css.go package css -import dom "github.com/brettlangdon/go-dom/v1" +import dom "github.com/brettlangdon/go-dom" import "syscall/js" var value dom.Value diff --git a/cssgroupingrule.go b/cssgroupingrule.go index c20432a..109d619 100644 --- a/cssgroupingrule.go +++ b/cssgroupingrule.go @@ -9,7 +9,7 @@ type CSSGroupingRuleIFace interface { GetCssText() string SetCssText(string) DeleteRule(args ...interface{}) - InsertRule(args ...interface{}) float64 + InsertRule(args ...interface{}) int GetParentRule() CSSRule GetParentStyleSheet() CSSStyleSheet GetType() int @@ -30,7 +30,7 @@ func (c CSSGroupingRule) GetCssRules() CSSRuleList { func (c CSSGroupingRule) DeleteRule(args ...interface{}) { c.Call("deleteRule", args...) } -func (c CSSGroupingRule) InsertRule(args ...interface{}) float64 { +func (c CSSGroupingRule) InsertRule(args ...interface{}) int { val := c.Call("insertRule", args...) - return val.Float() + return val.Int() } diff --git a/csspagerule.go b/csspagerule.go index 23c140f..33535a6 100644 --- a/csspagerule.go +++ b/csspagerule.go @@ -9,7 +9,7 @@ type CSSPageRuleIFace interface { GetCssText() string SetCssText(string) DeleteRule(args ...interface{}) - InsertRule(args ...interface{}) float64 + InsertRule(args ...interface{}) int GetParentRule() CSSRule GetParentStyleSheet() CSSStyleSheet GetSelectorText() string diff --git a/cssrulelist.go b/cssrulelist.go index bd1abf7..0257d86 100644 --- a/cssrulelist.go +++ b/cssrulelist.go @@ -6,7 +6,7 @@ import "syscall/js" type CSSRuleListIFace interface { Item(args ...interface{}) CSSRule - GetLength() float64 + GetLength() int } type CSSRuleList struct { Value @@ -18,7 +18,7 @@ func (c CSSRuleList) Item(args ...interface{}) CSSRule { val := c.Call("item", args...) return JSValueToCSSRule(val.JSValue()) } -func (c CSSRuleList) GetLength() float64 { +func (c CSSRuleList) GetLength() int { val := c.Get("length") - return val.Float() + return val.Int() } diff --git a/cssstyledeclaration.go b/cssstyledeclaration.go index 840cefb..d4f45f5 100644 --- a/cssstyledeclaration.go +++ b/cssstyledeclaration.go @@ -12,7 +12,7 @@ type CSSStyleDeclarationIFace interface { GetPropertyPriority(args ...interface{}) string GetPropertyValue(args ...interface{}) string Item(args ...interface{}) string - GetLength() float64 + GetLength() int GetParentRule() CSSRule RemoveProperty(args ...interface{}) string SetProperty(args ...interface{}) @@ -51,9 +51,9 @@ func (c CSSStyleDeclaration) Item(args ...interface{}) string { val := c.Call("item", args...) return val.String() } -func (c CSSStyleDeclaration) GetLength() float64 { +func (c CSSStyleDeclaration) GetLength() int { val := c.Get("length") - return val.Float() + return val.Int() } func (c CSSStyleDeclaration) GetParentRule() CSSRule { val := c.Get("parentRule") diff --git a/cssstylesheet.go b/cssstylesheet.go index 52f7d2c..c6b94ca 100644 --- a/cssstylesheet.go +++ b/cssstylesheet.go @@ -10,7 +10,7 @@ type CSSStyleSheetIFace interface { GetDisabled() bool SetDisabled(bool) GetHref() string - InsertRule(args ...interface{}) float64 + InsertRule(args ...interface{}) int GetMedia() MediaList GetOwnerNode() GetOwnerRule() CSSRule @@ -34,9 +34,9 @@ func (c CSSStyleSheet) GetCssRules() CSSRuleList { func (c CSSStyleSheet) DeleteRule(args ...interface{}) { c.Call("deleteRule", args...) } -func (c CSSStyleSheet) InsertRule(args ...interface{}) float64 { +func (c CSSStyleSheet) InsertRule(args ...interface{}) int { val := c.Call("insertRule", args...) - return val.Float() + return val.Int() } func (c CSSStyleSheet) GetOwnerRule() CSSRule { val := c.Get("ownerRule") diff --git a/datatransferitemlist.go b/datatransferitemlist.go index 4f9a83a..86f7aba 100644 --- a/datatransferitemlist.go +++ b/datatransferitemlist.go @@ -8,7 +8,7 @@ type DataTransferItemListIFace interface { Add(args ...interface{}) DataTransferItem AddWithArgs(args ...interface{}) DataTransferItem Clear(args ...interface{}) - GetLength() float64 + GetLength() int Remove(args ...interface{}) } type DataTransferItemList struct { @@ -30,9 +30,9 @@ func (d DataTransferItemList) AddWithArgs(args ...interface{}) DataTransferItem func (d DataTransferItemList) Clear(args ...interface{}) { d.Call("clear", args...) } -func (d DataTransferItemList) GetLength() float64 { +func (d DataTransferItemList) GetLength() int { val := d.Get("length") - return val.Float() + return val.Int() } func (d DataTransferItemList) Remove(args ...interface{}) { d.Call("remove", args...) diff --git a/dedicatedworkerglobalscope.go b/dedicatedworkerglobalscope.go index 0f986c6..c696640 100644 --- a/dedicatedworkerglobalscope.go +++ b/dedicatedworkerglobalscope.go @@ -31,7 +31,7 @@ type DedicatedWorkerGlobalScopeIFace interface { SetOnunhandledrejection(EventHandler) PostMessage(args ...interface{}) RemoveEventListener(args ...interface{}) - RequestAnimationFrame(args ...interface{}) float64 + RequestAnimationFrame(args ...interface{}) int GetSelf() WorkerGlobalScope } type DedicatedWorkerGlobalScope struct { @@ -73,7 +73,7 @@ func (d DedicatedWorkerGlobalScope) SetOnmessageerror(val EventHandler) { func (d DedicatedWorkerGlobalScope) PostMessage(args ...interface{}) { d.Call("postMessage", args...) } -func (d DedicatedWorkerGlobalScope) RequestAnimationFrame(args ...interface{}) float64 { +func (d DedicatedWorkerGlobalScope) RequestAnimationFrame(args ...interface{}) int { val := d.Call("requestAnimationFrame", args...) - return val.Float() + return val.Int() } diff --git a/document.go b/document.go index e80abe9..dead6c5 100644 --- a/document.go +++ b/document.go @@ -12,7 +12,7 @@ type DocumentIFace interface { GetBaseURI() string GetCharacterSet() string GetCharset() string - GetChildElementCount() float64 + GetChildElementCount() int GetChildNodes() NodeList GetChildren() HTMLCollection CloneNode(args ...interface{}) Node @@ -231,9 +231,9 @@ func (d Document) GetCharset() string { val := d.Get("charset") return val.String() } -func (d Document) GetChildElementCount() float64 { +func (d Document) GetChildElementCount() int { val := d.Get("childElementCount") - return val.Float() + return val.Int() } func (d Document) GetChildren() HTMLCollection { val := d.Get("children") diff --git a/document/document.go b/document/document.go index 2107607..61094ec 100644 --- a/document/document.go +++ b/document/document.go @@ -2,7 +2,7 @@ // document/document.go package document -import dom "github.com/brettlangdon/go-dom/v1" +import dom "github.com/brettlangdon/go-dom" import "syscall/js" var value dom.Document @@ -31,7 +31,7 @@ func GetCharacterSet() string { func GetCharset() string { return value.GetCharset() } -func GetChildElementCount() float64 { +func GetChildElementCount() int { return value.GetChildElementCount() } func GetChildNodes() dom.NodeList { diff --git a/documentfragment.go b/documentfragment.go index 2e83c3e..9bd7dfa 100644 --- a/documentfragment.go +++ b/documentfragment.go @@ -9,7 +9,7 @@ type DocumentFragmentIFace interface { Append(args ...interface{}) AppendChild(args ...interface{}) Node GetBaseURI() string - GetChildElementCount() float64 + GetChildElementCount() int GetChildNodes() NodeList GetChildren() HTMLCollection CloneNode(args ...interface{}) Node @@ -62,9 +62,9 @@ func (v Value) AsDocumentFragment() DocumentFragment { return DocumentFragment{V func (d DocumentFragment) Append(args ...interface{}) { d.Call("append", args...) } -func (d DocumentFragment) GetChildElementCount() float64 { +func (d DocumentFragment) GetChildElementCount() int { val := d.Get("childElementCount") - return val.Float() + return val.Int() } func (d DocumentFragment) GetChildren() HTMLCollection { val := d.Get("children") diff --git a/domrectlist.go b/domrectlist.go index f2e578c..ad39da5 100644 --- a/domrectlist.go +++ b/domrectlist.go @@ -6,7 +6,7 @@ import "syscall/js" type DOMRectListIFace interface { Item(args ...interface{}) DOMRect - GetLength() float64 + GetLength() int } type DOMRectList struct { Value @@ -18,7 +18,7 @@ func (d DOMRectList) Item(args ...interface{}) DOMRect { val := d.Call("item", args...) return JSValueToDOMRect(val.JSValue()) } -func (d DOMRectList) GetLength() float64 { +func (d DOMRectList) GetLength() int { val := d.Get("length") - return val.Float() + return val.Int() } diff --git a/domstringlist.go b/domstringlist.go index 8d9199f..8180f91 100644 --- a/domstringlist.go +++ b/domstringlist.go @@ -7,7 +7,7 @@ import "syscall/js" type DOMStringListIFace interface { Contains(args ...interface{}) bool Item(args ...interface{}) string - GetLength() float64 + GetLength() int } type DOMStringList struct { Value @@ -25,7 +25,7 @@ func (d DOMStringList) Item(args ...interface{}) string { val := d.Call("item", args...) return val.String() } -func (d DOMStringList) GetLength() float64 { +func (d DOMStringList) GetLength() int { val := d.Get("length") - return val.Float() + return val.Int() } diff --git a/domtimestamp.go b/domtimestamp.go index 310d116..53d014d 100644 --- a/domtimestamp.go +++ b/domtimestamp.go @@ -4,8 +4,8 @@ package dom import "syscall/js" -type DOMTimeStamp float64 +type DOMTimeStamp int func JSValueToDOMTimeStamp(val js.Value) DOMTimeStamp { - return DOMTimeStamp(val.Float()) + return DOMTimeStamp(val.Int()) } diff --git a/domtokenlist.go b/domtokenlist.go index 5bde089..b5b7383 100644 --- a/domtokenlist.go +++ b/domtokenlist.go @@ -8,7 +8,7 @@ type DOMTokenListIFace interface { Add(args ...interface{}) Contains(args ...interface{}) bool Item(args ...interface{}) string - GetLength() float64 + GetLength() int Remove(args ...interface{}) Replace(args ...interface{}) bool Supports(args ...interface{}) bool @@ -33,9 +33,9 @@ func (d DOMTokenList) Item(args ...interface{}) string { val := d.Call("item", args...) return val.String() } -func (d DOMTokenList) GetLength() float64 { +func (d DOMTokenList) GetLength() int { val := d.Get("length") - return val.Float() + return val.Int() } func (d DOMTokenList) Remove(args ...interface{}) { d.Call("remove", args...) diff --git a/element.go b/element.go index 7da3ed5..ec4e7fb 100644 --- a/element.go +++ b/element.go @@ -14,7 +14,7 @@ type ElementIFace interface { GetAttributes() NamedNodeMap GetBaseURI() string Before(args ...interface{}) - GetChildElementCount() float64 + GetChildElementCount() int GetChildNodes() NodeList GetChildren() HTMLCollection GetClassList() DOMTokenList @@ -122,9 +122,9 @@ func (e Element) GetAttributes() NamedNodeMap { func (e Element) Before(args ...interface{}) { e.Call("before", args...) } -func (e Element) GetChildElementCount() float64 { +func (e Element) GetChildElementCount() int { val := e.Get("childElementCount") - return val.Float() + return val.Int() } func (e Element) GetChildren() HTMLCollection { val := e.Get("children") diff --git a/errorevent.go b/errorevent.go index 561eda5..d0de736 100644 --- a/errorevent.go +++ b/errorevent.go @@ -9,7 +9,7 @@ type ErrorEventIFace interface { GetCancelBubble() bool SetCancelBubble(bool) GetCancelable() bool - GetColno() float64 + GetColno() int GetComposed() bool ComposedPath(args ...interface{}) GetCurrentTarget() EventTarget @@ -19,7 +19,7 @@ type ErrorEventIFace interface { GetFilename() string InitEvent(args ...interface{}) GetIsTrusted() bool - GetLineno() float64 + GetLineno() int GetMessage() string PreventDefault(args ...interface{}) GetReturnValue() bool @@ -38,9 +38,9 @@ type ErrorEvent struct { func JSValueToErrorEvent(val js.Value) ErrorEvent { return ErrorEvent{Value: Value{Value: val}} } func (v Value) AsErrorEvent() ErrorEvent { return ErrorEvent{Value: v} } -func (e ErrorEvent) GetColno() float64 { +func (e ErrorEvent) GetColno() int { val := e.Get("colno") - return val.Float() + return val.Int() } func (e ErrorEvent) GetError() Value { val := e.Get("error") @@ -50,9 +50,9 @@ func (e ErrorEvent) GetFilename() string { val := e.Get("filename") return val.String() } -func (e ErrorEvent) GetLineno() float64 { +func (e ErrorEvent) GetLineno() int { val := e.Get("lineno") - return val.Float() + return val.Int() } func (e ErrorEvent) GetMessage() string { val := e.Get("message") diff --git a/file.go b/file.go index 4927fbd..f293167 100644 --- a/file.go +++ b/file.go @@ -5,9 +5,9 @@ package dom import "syscall/js" type FileIFace interface { - GetLastModified() float64 + GetLastModified() int GetName() string - GetSize() float64 + GetSize() int Slice(args ...interface{}) Blob GetType() string } @@ -18,9 +18,9 @@ type File struct { func JSValueToFile(val js.Value) File { return File{Value: Value{Value: val}} } func (v Value) AsFile() File { return File{Value: v} } -func (f File) GetLastModified() float64 { +func (f File) GetLastModified() int { val := f.Get("lastModified") - return val.Float() + return val.Int() } func (f File) GetName() string { val := f.Get("name") diff --git a/filelist.go b/filelist.go index 1416270..3da3083 100644 --- a/filelist.go +++ b/filelist.go @@ -6,7 +6,7 @@ import "syscall/js" type FileListIFace interface { Item(args ...interface{}) File - GetLength() float64 + GetLength() int } type FileList struct { Value @@ -18,7 +18,7 @@ func (f FileList) Item(args ...interface{}) File { val := f.Call("item", args...) return JSValueToFile(val.JSValue()) } -func (f FileList) GetLength() float64 { +func (f FileList) GetLength() int { val := f.Get("length") - return val.Float() + return val.Int() } diff --git a/generate/generator.go b/generate/generator.go index 3f8b1ef..68d84b1 100644 --- a/generate/generator.go +++ b/generate/generator.go @@ -435,7 +435,7 @@ func (g *Generator) generateNamespace(spec Spec) (err error) { b.WriteString("// Code generated DO NOT EDIT") b.WriteF("// %s", fname) b.WriteF("package %s", d) - b.WriteString("import dom \"github.com/brettlangdon/go-dom/v1\"") + b.WriteString("import dom \"github.com/brettlangdon/go-dom\"") b.WriteString("import \"syscall/js\"") vt := "Value" diff --git a/generate/idl_type.go b/generate/idl_type.go index 3a55c36..bf405d3 100644 --- a/generate/idl_type.go +++ b/generate/idl_type.go @@ -24,11 +24,12 @@ func convertIDLType(idlType interface{}) string { switch t { case "USVString", "DOMString", "CSSOMString": t = "string" - case "unsigned long", "long", "unsigned long long", - "double", "unrestricted double", "long long": - t = "float64" - case "unsigned short", "short": + case "unsigned long", "unsigned long long", + "long", "long long", + "unsigned short", "short": t = "int" + case "double", "unrestricted double": + t = "float64" case "boolean": t = "bool" case "any", "object": diff --git a/generate/static/value.go b/generate/static/value.go index 56c8722..a47a653 100644 --- a/generate/static/value.go +++ b/generate/static/value.go @@ -16,11 +16,28 @@ func (v Value) JSValue() js.Value { return v.Value } func (v Value) Get(p string) Value { return JSValueToValue(v.Value.Get(p)) } func (v Value) Index(i int) Value { return JSValueToValue(v.Value.Index(i)) } func (v Value) Call(m string, args ...interface{}) Value { + for i, a := range args { + args[i] = GetJSValue(a) + } return JSValueToValue(v.Value.Call(m, args...)) } func (v Value) Invoke(args ...interface{}) Value { + for i, a := range args { + args[i] = GetJSValue(a) + } return JSValueToValue(v.Value.Invoke(args...)) } func (v Value) New(args ...interface{}) Value { + for i, a := range args { + args[i] = GetJSValue(a) + } return JSValueToValue(v.Value.New(args...)) } + +func GetJSValue(v interface{}) interface{} { + t, ok := v.(JSValue) + if ok { + return t.JSValue() + } + return v +} diff --git a/go.mod b/go.mod index fb79674..5668795 100644 --- a/go.mod +++ b/go.mod @@ -1 +1 @@ -module github.com/brettlangdon/go-dom/v1 +module github.com/brettlangdon/go-dom diff --git a/history.go b/history.go index 0edc7a1..c7f9dbc 100644 --- a/history.go +++ b/history.go @@ -8,7 +8,7 @@ type HistoryIFace interface { Back(args ...interface{}) Forward(args ...interface{}) Go(args ...interface{}) - GetLength() float64 + GetLength() int PushState(args ...interface{}) ReplaceState(args ...interface{}) GetScrollRestoration() ScrollRestoration @@ -30,9 +30,9 @@ func (h History) Forward(args ...interface{}) { func (h History) Go(args ...interface{}) { h.Call("go", args...) } -func (h History) GetLength() float64 { +func (h History) GetLength() int { val := h.Get("length") - return val.Float() + return val.Int() } func (h History) PushState(args ...interface{}) { h.Call("pushState", args...) diff --git a/htmlallcollection.go b/htmlallcollection.go index a29b711..d4fd413 100644 --- a/htmlallcollection.go +++ b/htmlallcollection.go @@ -6,7 +6,7 @@ import "syscall/js" type HTMLAllCollectionIFace interface { Item(args ...interface{}) - GetLength() float64 + GetLength() int NamedItem(args ...interface{}) } type HTMLAllCollection struct { @@ -20,9 +20,9 @@ func (v Value) AsHTMLAllCollection() HTMLAllCollection { return HTMLAllCollectio func (h HTMLAllCollection) Item(args ...interface{}) { h.Call("item", args...) } -func (h HTMLAllCollection) GetLength() float64 { +func (h HTMLAllCollection) GetLength() int { val := h.Get("length") - return val.Float() + return val.Int() } func (h HTMLAllCollection) NamedItem(args ...interface{}) { h.Call("namedItem", args...) diff --git a/htmlcanvaselement.go b/htmlcanvaselement.go index 168c020..5f939c2 100644 --- a/htmlcanvaselement.go +++ b/htmlcanvaselement.go @@ -44,8 +44,8 @@ type HTMLCanvasElementIFace interface { HasAttributeNS(args ...interface{}) bool HasAttributes(args ...interface{}) bool HasChildNodes(args ...interface{}) bool - GetHeight() float64 - SetHeight(float64) + GetHeight() int + SetHeight(int) GetHidden() bool SetHidden(bool) GetId() string @@ -105,8 +105,8 @@ type HTMLCanvasElementIFace interface { GetTranslate() bool SetTranslate(bool) WebkitMatchesSelector(args ...interface{}) bool - GetWidth() float64 - SetWidth(float64) + GetWidth() int + SetWidth(int) } type HTMLCanvasElement struct { Value @@ -124,11 +124,11 @@ func (h HTMLCanvasElement) GetContext(args ...interface{}) RenderingContext { val := h.Call("getContext", args...) return JSValueToRenderingContext(val.JSValue()) } -func (h HTMLCanvasElement) GetHeight() float64 { +func (h HTMLCanvasElement) GetHeight() int { val := h.Get("height") - return val.Float() + return val.Int() } -func (h HTMLCanvasElement) SetHeight(val float64) { +func (h HTMLCanvasElement) SetHeight(val int) { h.Set("height", val) } func (h HTMLCanvasElement) ToBlob(args ...interface{}) { @@ -142,10 +142,10 @@ func (h HTMLCanvasElement) TransferControlToOffscreen(args ...interface{}) Offsc val := h.Call("transferControlToOffscreen", args...) return JSValueToOffscreenCanvas(val.JSValue()) } -func (h HTMLCanvasElement) GetWidth() float64 { +func (h HTMLCanvasElement) GetWidth() int { val := h.Get("width") - return val.Float() + return val.Int() } -func (h HTMLCanvasElement) SetWidth(val float64) { +func (h HTMLCanvasElement) SetWidth(val int) { h.Set("width", val) } diff --git a/htmlcollection.go b/htmlcollection.go index d23ed67..cc120b5 100644 --- a/htmlcollection.go +++ b/htmlcollection.go @@ -6,7 +6,7 @@ import "syscall/js" type HTMLCollectionIFace interface { Item(args ...interface{}) Element - GetLength() float64 + GetLength() int NamedItem(args ...interface{}) Element } type HTMLCollection struct { @@ -21,9 +21,9 @@ func (h HTMLCollection) Item(args ...interface{}) Element { val := h.Call("item", args...) return JSValueToElement(val.JSValue()) } -func (h HTMLCollection) GetLength() float64 { +func (h HTMLCollection) GetLength() int { val := h.Get("length") - return val.Float() + return val.Int() } func (h HTMLCollection) NamedItem(args ...interface{}) Element { val := h.Call("namedItem", args...) diff --git a/htmlelement.go b/htmlelement.go index 6d5a010..5bc9a10 100644 --- a/htmlelement.go +++ b/htmlelement.go @@ -233,8 +233,8 @@ type HTMLElementIFace interface { GetSpellcheck() bool SetSpellcheck(bool) GetStyle() CSSStyleDeclaration - GetTabIndex() float64 - SetTabIndex(float64) + GetTabIndex() int + SetTabIndex(int) GetTagName() string GetTextContent() string SetTextContent(string) @@ -818,11 +818,11 @@ func (h HTMLElement) GetStyle() CSSStyleDeclaration { val := h.Get("style") return JSValueToCSSStyleDeclaration(val.JSValue()) } -func (h HTMLElement) GetTabIndex() float64 { +func (h HTMLElement) GetTabIndex() int { val := h.Get("tabIndex") - return val.Float() + return val.Int() } -func (h HTMLElement) SetTabIndex(val float64) { +func (h HTMLElement) SetTabIndex(val int) { h.Set("tabIndex", val) } func (h HTMLElement) GetTitle() string { diff --git a/htmlformcontrolscollection.go b/htmlformcontrolscollection.go index 695f53d..7ef81e8 100644 --- a/htmlformcontrolscollection.go +++ b/htmlformcontrolscollection.go @@ -6,7 +6,7 @@ import "syscall/js" type HTMLFormControlsCollectionIFace interface { Item(args ...interface{}) Element - GetLength() float64 + GetLength() int NamedItem(args ...interface{}) } type HTMLFormControlsCollection struct { diff --git a/htmlformelement.go b/htmlformelement.go index 8445507..cad6377 100644 --- a/htmlformelement.go +++ b/htmlformelement.go @@ -71,7 +71,7 @@ type HTMLFormElementIFace interface { GetLang() string SetLang(string) GetLastChild() Node - GetLength() float64 + GetLength() int GetLocalName() string LookupNamespaceURI(args ...interface{}) string LookupPrefix(args ...interface{}) string @@ -179,9 +179,9 @@ func (h HTMLFormElement) GetEnctype() string { func (h HTMLFormElement) SetEnctype(val string) { h.Set("enctype", val) } -func (h HTMLFormElement) GetLength() float64 { +func (h HTMLFormElement) GetLength() int { val := h.Get("length") - return val.Float() + return val.Int() } func (h HTMLFormElement) GetMethod() string { val := h.Get("method") diff --git a/htmlimageelement.go b/htmlimageelement.go index a072314..7ade732 100644 --- a/htmlimageelement.go +++ b/htmlimageelement.go @@ -52,8 +52,8 @@ type HTMLImageElementIFace interface { HasAttributeNS(args ...interface{}) bool HasAttributes(args ...interface{}) bool HasChildNodes(args ...interface{}) bool - GetHeight() float64 - SetHeight(float64) + GetHeight() int + SetHeight(int) GetHidden() bool SetHidden(bool) GetId() string @@ -77,8 +77,8 @@ type HTMLImageElementIFace interface { LookupPrefix(args ...interface{}) string Matches(args ...interface{}) bool GetNamespaceURI() string - GetNaturalHeight() float64 - GetNaturalWidth() float64 + GetNaturalHeight() int + GetNaturalWidth() int GetNextSibling() Node GetNodeName() string GetNodeType() int @@ -124,8 +124,8 @@ type HTMLImageElementIFace interface { GetUseMap() string SetUseMap(string) WebkitMatchesSelector(args ...interface{}) bool - GetWidth() float64 - SetWidth(float64) + GetWidth() int + SetWidth(int) } type HTMLImageElement struct { Value @@ -171,11 +171,11 @@ func (h HTMLImageElement) GetDecoding() string { func (h HTMLImageElement) SetDecoding(val string) { h.Set("decoding", val) } -func (h HTMLImageElement) GetHeight() float64 { +func (h HTMLImageElement) GetHeight() int { val := h.Get("height") - return val.Float() + return val.Int() } -func (h HTMLImageElement) SetHeight(val float64) { +func (h HTMLImageElement) SetHeight(val int) { h.Set("height", val) } func (h HTMLImageElement) GetIsMap() bool { @@ -185,13 +185,13 @@ func (h HTMLImageElement) GetIsMap() bool { func (h HTMLImageElement) SetIsMap(val bool) { h.Set("isMap", val) } -func (h HTMLImageElement) GetNaturalHeight() float64 { +func (h HTMLImageElement) GetNaturalHeight() int { val := h.Get("naturalHeight") - return val.Float() + return val.Int() } -func (h HTMLImageElement) GetNaturalWidth() float64 { +func (h HTMLImageElement) GetNaturalWidth() int { val := h.Get("naturalWidth") - return val.Float() + return val.Int() } func (h HTMLImageElement) GetReferrerPolicy() string { val := h.Get("referrerPolicy") @@ -228,10 +228,10 @@ func (h HTMLImageElement) GetUseMap() string { func (h HTMLImageElement) SetUseMap(val string) { h.Set("useMap", val) } -func (h HTMLImageElement) GetWidth() float64 { +func (h HTMLImageElement) GetWidth() int { val := h.Get("width") - return val.Float() + return val.Int() } -func (h HTMLImageElement) SetWidth(val float64) { +func (h HTMLImageElement) SetWidth(val int) { h.Set("width", val) } diff --git a/htmlinputelement.go b/htmlinputelement.go index 00280a1..c45bf9d 100644 --- a/htmlinputelement.go +++ b/htmlinputelement.go @@ -75,8 +75,8 @@ type HTMLInputElementIFace interface { HasAttributeNS(args ...interface{}) bool HasAttributes(args ...interface{}) bool HasChildNodes(args ...interface{}) bool - GetHeight() float64 - SetHeight(float64) + GetHeight() int + SetHeight(int) GetHidden() bool SetHidden(bool) GetId() string @@ -103,12 +103,12 @@ type HTMLInputElementIFace interface { Matches(args ...interface{}) bool GetMax() string SetMax(string) - GetMaxLength() float64 - SetMaxLength(float64) + GetMaxLength() int + SetMaxLength(int) GetMin() string SetMin(string) - GetMinLength() float64 - SetMinLength(float64) + GetMinLength() int + SetMinLength(int) GetMultiple() bool SetMultiple(bool) GetName() string @@ -143,10 +143,10 @@ type HTMLInputElementIFace interface { Select(args ...interface{}) GetSelectionDirection() string SetSelectionDirection(string) - GetSelectionEnd() float64 - SetSelectionEnd(float64) - GetSelectionStart() float64 - SetSelectionStart(float64) + GetSelectionEnd() int + SetSelectionEnd(int) + GetSelectionStart() int + SetSelectionStart(int) SetAttribute(args ...interface{}) SetAttributeNS(args ...interface{}) SetAttributeNode(args ...interface{}) Attr @@ -156,8 +156,8 @@ type HTMLInputElementIFace interface { SetRangeTextWithArgs(args ...interface{}) SetSelectionRange(args ...interface{}) GetShadowRoot() ShadowRoot - GetSize() float64 - SetSize(float64) + GetSize() int + SetSize(int) GetSlot() string SetSlot(string) GetSpellcheck() bool @@ -187,8 +187,8 @@ type HTMLInputElementIFace interface { GetValueAsNumber() float64 SetValueAsNumber(float64) WebkitMatchesSelector(args ...interface{}) bool - GetWidth() float64 - SetWidth(float64) + GetWidth() int + SetWidth(int) GetWillValidate() bool } type HTMLInputElement struct { @@ -316,11 +316,11 @@ func (h HTMLInputElement) GetFormTarget() string { func (h HTMLInputElement) SetFormTarget(val string) { h.Set("formTarget", val) } -func (h HTMLInputElement) GetHeight() float64 { +func (h HTMLInputElement) GetHeight() int { val := h.Get("height") - return val.Float() + return val.Int() } -func (h HTMLInputElement) SetHeight(val float64) { +func (h HTMLInputElement) SetHeight(val int) { h.Set("height", val) } func (h HTMLInputElement) GetIndeterminate() bool { @@ -345,11 +345,11 @@ func (h HTMLInputElement) GetMax() string { func (h HTMLInputElement) SetMax(val string) { h.Set("max", val) } -func (h HTMLInputElement) GetMaxLength() float64 { +func (h HTMLInputElement) GetMaxLength() int { val := h.Get("maxLength") - return val.Float() + return val.Int() } -func (h HTMLInputElement) SetMaxLength(val float64) { +func (h HTMLInputElement) SetMaxLength(val int) { h.Set("maxLength", val) } func (h HTMLInputElement) GetMin() string { @@ -359,11 +359,11 @@ func (h HTMLInputElement) GetMin() string { func (h HTMLInputElement) SetMin(val string) { h.Set("min", val) } -func (h HTMLInputElement) GetMinLength() float64 { +func (h HTMLInputElement) GetMinLength() int { val := h.Get("minLength") - return val.Float() + return val.Int() } -func (h HTMLInputElement) SetMinLength(val float64) { +func (h HTMLInputElement) SetMinLength(val int) { h.Set("minLength", val) } func (h HTMLInputElement) GetMultiple() bool { @@ -422,18 +422,18 @@ func (h HTMLInputElement) GetSelectionDirection() string { func (h HTMLInputElement) SetSelectionDirection(val string) { h.Set("selectionDirection", val) } -func (h HTMLInputElement) GetSelectionEnd() float64 { +func (h HTMLInputElement) GetSelectionEnd() int { val := h.Get("selectionEnd") - return val.Float() + return val.Int() } -func (h HTMLInputElement) SetSelectionEnd(val float64) { +func (h HTMLInputElement) SetSelectionEnd(val int) { h.Set("selectionEnd", val) } -func (h HTMLInputElement) GetSelectionStart() float64 { +func (h HTMLInputElement) GetSelectionStart() int { val := h.Get("selectionStart") - return val.Float() + return val.Int() } -func (h HTMLInputElement) SetSelectionStart(val float64) { +func (h HTMLInputElement) SetSelectionStart(val int) { h.Set("selectionStart", val) } func (h HTMLInputElement) SetCustomValidity(args ...interface{}) { @@ -448,11 +448,11 @@ func (h HTMLInputElement) SetRangeTextWithArgs(args ...interface{}) { func (h HTMLInputElement) SetSelectionRange(args ...interface{}) { h.Call("setSelectionRange", args...) } -func (h HTMLInputElement) GetSize() float64 { +func (h HTMLInputElement) GetSize() int { val := h.Get("size") - return val.Float() + return val.Int() } -func (h HTMLInputElement) SetSize(val float64) { +func (h HTMLInputElement) SetSize(val int) { h.Set("size", val) } func (h HTMLInputElement) GetSrc() string { @@ -511,11 +511,11 @@ func (h HTMLInputElement) GetValueAsNumber() float64 { func (h HTMLInputElement) SetValueAsNumber(val float64) { h.Set("valueAsNumber", val) } -func (h HTMLInputElement) GetWidth() float64 { +func (h HTMLInputElement) GetWidth() int { val := h.Get("width") - return val.Float() + return val.Int() } -func (h HTMLInputElement) SetWidth(val float64) { +func (h HTMLInputElement) SetWidth(val int) { h.Set("width", val) } func (h HTMLInputElement) GetWillValidate() bool { diff --git a/htmllielement.go b/htmllielement.go index 625ee25..ddf76b2 100644 --- a/htmllielement.go +++ b/htmllielement.go @@ -98,8 +98,8 @@ type HTMLLIElementIFace interface { ToggleAttribute(args ...interface{}) bool GetTranslate() bool SetTranslate(bool) - GetValue() float64 - SetValue(float64) + GetValue() int + SetValue(int) WebkitMatchesSelector(args ...interface{}) bool } type HTMLLIElement struct { @@ -114,10 +114,10 @@ func JSValueToHTMLLIElement(val js.Value) HTMLLIElement { return HTMLLIElement{Value: Value{Value: val}} } func (v Value) AsHTMLLIElement() HTMLLIElement { return HTMLLIElement{Value: v} } -func (h HTMLLIElement) GetValue() float64 { +func (h HTMLLIElement) GetValue() int { val := h.Get("value") - return val.Float() + return val.Int() } -func (h HTMLLIElement) SetValue(val float64) { +func (h HTMLLIElement) SetValue(val int) { h.Set("value", val) } diff --git a/htmlmarqueeelement.go b/htmlmarqueeelement.go index 3b5d11d..5b10c41 100644 --- a/htmlmarqueeelement.go +++ b/htmlmarqueeelement.go @@ -53,8 +53,8 @@ type HTMLMarqueeElementIFace interface { SetHeight(string) GetHidden() bool SetHidden(bool) - GetHspace() float64 - SetHspace(float64) + GetHspace() int + SetHspace(int) GetId() string SetId(string) GetInnerText() string @@ -72,8 +72,8 @@ type HTMLMarqueeElementIFace interface { GetLocalName() string LookupNamespaceURI(args ...interface{}) string LookupPrefix(args ...interface{}) string - GetLoop() float64 - SetLoop(float64) + GetLoop() int + SetLoop(int) Matches(args ...interface{}) bool GetNamespaceURI() string GetNextSibling() Node @@ -99,10 +99,10 @@ type HTMLMarqueeElementIFace interface { RemoveChild(args ...interface{}) Node RemoveEventListener(args ...interface{}) ReplaceChild(args ...interface{}) Node - GetScrollAmount() float64 - SetScrollAmount(float64) - GetScrollDelay() float64 - SetScrollDelay(float64) + GetScrollAmount() int + SetScrollAmount(int) + GetScrollDelay() int + SetScrollDelay(int) SetAttribute(args ...interface{}) SetAttributeNS(args ...interface{}) SetAttributeNode(args ...interface{}) Attr @@ -124,8 +124,8 @@ type HTMLMarqueeElementIFace interface { SetTranslate(bool) GetTrueSpeed() bool SetTrueSpeed(bool) - GetVspace() float64 - SetVspace(float64) + GetVspace() int + SetVspace(int) WebkitMatchesSelector(args ...interface{}) bool GetWidth() string SetWidth(string) @@ -170,18 +170,18 @@ func (h HTMLMarqueeElement) GetHeight() string { func (h HTMLMarqueeElement) SetHeight(val string) { h.Set("height", val) } -func (h HTMLMarqueeElement) GetHspace() float64 { +func (h HTMLMarqueeElement) GetHspace() int { val := h.Get("hspace") - return val.Float() + return val.Int() } -func (h HTMLMarqueeElement) SetHspace(val float64) { +func (h HTMLMarqueeElement) SetHspace(val int) { h.Set("hspace", val) } -func (h HTMLMarqueeElement) GetLoop() float64 { +func (h HTMLMarqueeElement) GetLoop() int { val := h.Get("loop") - return val.Float() + return val.Int() } -func (h HTMLMarqueeElement) SetLoop(val float64) { +func (h HTMLMarqueeElement) SetLoop(val int) { h.Set("loop", val) } func (h HTMLMarqueeElement) GetOnbounce() EventHandler { @@ -205,18 +205,18 @@ func (h HTMLMarqueeElement) GetOnstart() EventHandler { func (h HTMLMarqueeElement) SetOnstart(val EventHandler) { h.Set("onstart", val) } -func (h HTMLMarqueeElement) GetScrollAmount() float64 { +func (h HTMLMarqueeElement) GetScrollAmount() int { val := h.Get("scrollAmount") - return val.Float() + return val.Int() } -func (h HTMLMarqueeElement) SetScrollAmount(val float64) { +func (h HTMLMarqueeElement) SetScrollAmount(val int) { h.Set("scrollAmount", val) } -func (h HTMLMarqueeElement) GetScrollDelay() float64 { +func (h HTMLMarqueeElement) GetScrollDelay() int { val := h.Get("scrollDelay") - return val.Float() + return val.Int() } -func (h HTMLMarqueeElement) SetScrollDelay(val float64) { +func (h HTMLMarqueeElement) SetScrollDelay(val int) { h.Set("scrollDelay", val) } func (h HTMLMarqueeElement) Start(args ...interface{}) { @@ -232,11 +232,11 @@ func (h HTMLMarqueeElement) GetTrueSpeed() bool { func (h HTMLMarqueeElement) SetTrueSpeed(val bool) { h.Set("trueSpeed", val) } -func (h HTMLMarqueeElement) GetVspace() float64 { +func (h HTMLMarqueeElement) GetVspace() int { val := h.Get("vspace") - return val.Float() + return val.Int() } -func (h HTMLMarqueeElement) SetVspace(val float64) { +func (h HTMLMarqueeElement) SetVspace(val int) { h.Set("vspace", val) } func (h HTMLMarqueeElement) GetWidth() string { diff --git a/htmlolistelement.go b/htmlolistelement.go index 8351c84..74cb557 100644 --- a/htmlolistelement.go +++ b/htmlolistelement.go @@ -92,8 +92,8 @@ type HTMLOListElementIFace interface { SetSlot(string) GetSpellcheck() bool SetSpellcheck(bool) - GetStart() float64 - SetStart(float64) + GetStart() int + SetStart(int) GetTagName() string GetTextContent() string SetTextContent(string) @@ -125,11 +125,11 @@ func (h HTMLOListElement) GetReversed() bool { func (h HTMLOListElement) SetReversed(val bool) { h.Set("reversed", val) } -func (h HTMLOListElement) GetStart() float64 { +func (h HTMLOListElement) GetStart() int { val := h.Get("start") - return val.Float() + return val.Int() } -func (h HTMLOListElement) SetStart(val float64) { +func (h HTMLOListElement) SetStart(val int) { h.Set("start", val) } func (h HTMLOListElement) GetType() string { diff --git a/htmloptionelement.go b/htmloptionelement.go index 603ac09..4d7618c 100644 --- a/htmloptionelement.go +++ b/htmloptionelement.go @@ -52,7 +52,7 @@ type HTMLOptionElementIFace interface { SetHidden(bool) GetId() string SetId(string) - GetIndex() float64 + GetIndex() int GetInnerText() string SetInnerText(string) InsertAdjacentElement(args ...interface{}) Element @@ -144,9 +144,9 @@ func (h HTMLOptionElement) GetForm() HTMLFormElement { val := h.Get("form") return JSValueToHTMLFormElement(val.JSValue()) } -func (h HTMLOptionElement) GetIndex() float64 { +func (h HTMLOptionElement) GetIndex() int { val := h.Get("index") - return val.Float() + return val.Int() } func (h HTMLOptionElement) GetLabel() string { val := h.Get("label") diff --git a/htmloptionscollection.go b/htmloptionscollection.go index c6e4808..6fbe4f0 100644 --- a/htmloptionscollection.go +++ b/htmloptionscollection.go @@ -7,12 +7,12 @@ import "syscall/js" type HTMLOptionsCollectionIFace interface { Add(args ...interface{}) Item(args ...interface{}) Element - GetLength() float64 - SetLength(float64) + GetLength() int + SetLength(int) NamedItem(args ...interface{}) Element Remove(args ...interface{}) - GetSelectedIndex() float64 - SetSelectedIndex(float64) + GetSelectedIndex() int + SetSelectedIndex(int) } type HTMLOptionsCollection struct { Value @@ -26,20 +26,20 @@ func (v Value) AsHTMLOptionsCollection() HTMLOptionsCollection { return HTMLOpti func (h HTMLOptionsCollection) Add(args ...interface{}) { h.Call("add", args...) } -func (h HTMLOptionsCollection) GetLength() float64 { +func (h HTMLOptionsCollection) GetLength() int { val := h.Get("length") - return val.Float() + return val.Int() } -func (h HTMLOptionsCollection) SetLength(val float64) { +func (h HTMLOptionsCollection) SetLength(val int) { h.Set("length", val) } func (h HTMLOptionsCollection) Remove(args ...interface{}) { h.Call("remove", args...) } -func (h HTMLOptionsCollection) GetSelectedIndex() float64 { +func (h HTMLOptionsCollection) GetSelectedIndex() int { val := h.Get("selectedIndex") - return val.Float() + return val.Int() } -func (h HTMLOptionsCollection) SetSelectedIndex(val float64) { +func (h HTMLOptionsCollection) SetSelectedIndex(val int) { h.Set("selectedIndex", val) } diff --git a/htmlselectelement.go b/htmlselectelement.go index 6d6392c..7e1060f 100644 --- a/htmlselectelement.go +++ b/htmlselectelement.go @@ -70,8 +70,8 @@ type HTMLSelectElementIFace interface { GetLang() string SetLang(string) GetLastChild() Node - GetLength() float64 - SetLength(float64) + GetLength() int + SetLength(int) GetLocalName() string LookupNamespaceURI(args ...interface{}) string LookupPrefix(args ...interface{}) string @@ -105,8 +105,8 @@ type HTMLSelectElementIFace interface { ReportValidity(args ...interface{}) bool GetRequired() bool SetRequired(bool) - GetSelectedIndex() float64 - SetSelectedIndex(float64) + GetSelectedIndex() int + SetSelectedIndex(int) GetSelectedOptions() HTMLCollection SetAttribute(args ...interface{}) SetAttributeNS(args ...interface{}) @@ -114,8 +114,8 @@ type HTMLSelectElementIFace interface { SetAttributeNodeNS(args ...interface{}) Attr SetCustomValidity(args ...interface{}) GetShadowRoot() ShadowRoot - GetSize() float64 - SetSize(float64) + GetSize() int + SetSize(int) GetSlot() string SetSlot(string) GetSpellcheck() bool @@ -188,11 +188,11 @@ func (h HTMLSelectElement) GetLabels() NodeList { val := h.Get("labels") return JSValueToNodeList(val.JSValue()) } -func (h HTMLSelectElement) GetLength() float64 { +func (h HTMLSelectElement) GetLength() int { val := h.Get("length") - return val.Float() + return val.Int() } -func (h HTMLSelectElement) SetLength(val float64) { +func (h HTMLSelectElement) SetLength(val int) { h.Set("length", val) } func (h HTMLSelectElement) GetMultiple() bool { @@ -234,11 +234,11 @@ func (h HTMLSelectElement) GetRequired() bool { func (h HTMLSelectElement) SetRequired(val bool) { h.Set("required", val) } -func (h HTMLSelectElement) GetSelectedIndex() float64 { +func (h HTMLSelectElement) GetSelectedIndex() int { val := h.Get("selectedIndex") - return val.Float() + return val.Int() } -func (h HTMLSelectElement) SetSelectedIndex(val float64) { +func (h HTMLSelectElement) SetSelectedIndex(val int) { h.Set("selectedIndex", val) } func (h HTMLSelectElement) GetSelectedOptions() HTMLCollection { @@ -248,11 +248,11 @@ func (h HTMLSelectElement) GetSelectedOptions() HTMLCollection { func (h HTMLSelectElement) SetCustomValidity(args ...interface{}) { h.Call("setCustomValidity", args...) } -func (h HTMLSelectElement) GetSize() float64 { +func (h HTMLSelectElement) GetSize() int { val := h.Get("size") - return val.Float() + return val.Int() } -func (h HTMLSelectElement) SetSize(val float64) { +func (h HTMLSelectElement) SetSize(val int) { h.Set("size", val) } func (h HTMLSelectElement) GetType() string { diff --git a/htmltablecellelement.go b/htmltablecellelement.go index 1618e0d..f94c4d9 100644 --- a/htmltablecellelement.go +++ b/htmltablecellelement.go @@ -17,7 +17,7 @@ type HTMLTableCellElementIFace interface { GetAutocapitalize() string SetAutocapitalize(string) GetBaseURI() string - GetCellIndex() float64 + GetCellIndex() int GetChildNodes() NodeList GetClassList() DOMTokenList GetClassName() string @@ -25,8 +25,8 @@ type HTMLTableCellElementIFace interface { Click(args ...interface{}) CloneNode(args ...interface{}) Node Closest(args ...interface{}) Element - GetColSpan() float64 - SetColSpan(float64) + GetColSpan() int + SetColSpan(int) CompareDocumentPosition(args ...interface{}) int Contains(args ...interface{}) bool GetDir() string @@ -88,8 +88,8 @@ type HTMLTableCellElementIFace interface { RemoveChild(args ...interface{}) Node RemoveEventListener(args ...interface{}) ReplaceChild(args ...interface{}) Node - GetRowSpan() float64 - SetRowSpan(float64) + GetRowSpan() int + SetRowSpan(int) GetScope() string SetScope(string) SetAttribute(args ...interface{}) @@ -130,15 +130,15 @@ func (h HTMLTableCellElement) GetAbbr() string { func (h HTMLTableCellElement) SetAbbr(val string) { h.Set("abbr", val) } -func (h HTMLTableCellElement) GetCellIndex() float64 { +func (h HTMLTableCellElement) GetCellIndex() int { val := h.Get("cellIndex") - return val.Float() + return val.Int() } -func (h HTMLTableCellElement) GetColSpan() float64 { +func (h HTMLTableCellElement) GetColSpan() int { val := h.Get("colSpan") - return val.Float() + return val.Int() } -func (h HTMLTableCellElement) SetColSpan(val float64) { +func (h HTMLTableCellElement) SetColSpan(val int) { h.Set("colSpan", val) } func (h HTMLTableCellElement) GetHeaders() string { @@ -148,11 +148,11 @@ func (h HTMLTableCellElement) GetHeaders() string { func (h HTMLTableCellElement) SetHeaders(val string) { h.Set("headers", val) } -func (h HTMLTableCellElement) GetRowSpan() float64 { +func (h HTMLTableCellElement) GetRowSpan() int { val := h.Get("rowSpan") - return val.Float() + return val.Int() } -func (h HTMLTableCellElement) SetRowSpan(val float64) { +func (h HTMLTableCellElement) SetRowSpan(val int) { h.Set("rowSpan", val) } func (h HTMLTableCellElement) GetScope() string { diff --git a/htmltablecolelement.go b/htmltablecolelement.go index ee8387f..6301dec 100644 --- a/htmltablecolelement.go +++ b/htmltablecolelement.go @@ -88,8 +88,8 @@ type HTMLTableColElementIFace interface { GetShadowRoot() ShadowRoot GetSlot() string SetSlot(string) - GetSpan() float64 - SetSpan(float64) + GetSpan() int + SetSpan(int) GetSpellcheck() bool SetSpellcheck(bool) GetTagName() string @@ -114,10 +114,10 @@ func JSValueToHTMLTableColElement(val js.Value) HTMLTableColElement { return HTMLTableColElement{Value: Value{Value: val}} } func (v Value) AsHTMLTableColElement() HTMLTableColElement { return HTMLTableColElement{Value: v} } -func (h HTMLTableColElement) GetSpan() float64 { +func (h HTMLTableColElement) GetSpan() int { val := h.Get("span") - return val.Float() + return val.Int() } -func (h HTMLTableColElement) SetSpan(val float64) { +func (h HTMLTableColElement) SetSpan(val int) { h.Set("span", val) } diff --git a/htmltablerowelement.go b/htmltablerowelement.go index e6a8bb3..5714f30 100644 --- a/htmltablerowelement.go +++ b/htmltablerowelement.go @@ -84,8 +84,8 @@ type HTMLTableRowElementIFace interface { RemoveChild(args ...interface{}) Node RemoveEventListener(args ...interface{}) ReplaceChild(args ...interface{}) Node - GetRowIndex() float64 - GetSectionRowIndex() float64 + GetRowIndex() int + GetSectionRowIndex() int SetAttribute(args ...interface{}) SetAttributeNS(args ...interface{}) SetAttributeNode(args ...interface{}) Attr @@ -128,11 +128,11 @@ func (h HTMLTableRowElement) InsertCell(args ...interface{}) HTMLTableCellElemen val := h.Call("insertCell", args...) return JSValueToHTMLTableCellElement(val.JSValue()) } -func (h HTMLTableRowElement) GetRowIndex() float64 { +func (h HTMLTableRowElement) GetRowIndex() int { val := h.Get("rowIndex") - return val.Float() + return val.Int() } -func (h HTMLTableRowElement) GetSectionRowIndex() float64 { +func (h HTMLTableRowElement) GetSectionRowIndex() int { val := h.Get("sectionRowIndex") - return val.Float() + return val.Int() } diff --git a/htmltextareaelement.go b/htmltextareaelement.go index 87a1746..be2df36 100644 --- a/htmltextareaelement.go +++ b/htmltextareaelement.go @@ -27,8 +27,8 @@ type HTMLTextAreaElementIFace interface { Click(args ...interface{}) CloneNode(args ...interface{}) Node Closest(args ...interface{}) Element - GetCols() float64 - SetCols(float64) + GetCols() int + SetCols(int) CompareDocumentPosition(args ...interface{}) int Contains(args ...interface{}) bool GetDefaultValue() string @@ -78,10 +78,10 @@ type HTMLTextAreaElementIFace interface { LookupNamespaceURI(args ...interface{}) string LookupPrefix(args ...interface{}) string Matches(args ...interface{}) bool - GetMaxLength() float64 - SetMaxLength(float64) - GetMinLength() float64 - SetMinLength(float64) + GetMaxLength() int + SetMaxLength(int) + GetMinLength() int + SetMinLength(int) GetName() string SetName(string) GetNamespaceURI() string @@ -109,15 +109,15 @@ type HTMLTextAreaElementIFace interface { ReportValidity(args ...interface{}) bool GetRequired() bool SetRequired(bool) - GetRows() float64 - SetRows(float64) + GetRows() int + SetRows(int) Select(args ...interface{}) GetSelectionDirection() string SetSelectionDirection(string) - GetSelectionEnd() float64 - SetSelectionEnd(float64) - GetSelectionStart() float64 - SetSelectionStart(float64) + GetSelectionEnd() int + SetSelectionEnd(int) + GetSelectionStart() int + SetSelectionStart(int) SetAttribute(args ...interface{}) SetAttributeNS(args ...interface{}) SetAttributeNode(args ...interface{}) Attr @@ -134,7 +134,7 @@ type HTMLTextAreaElementIFace interface { GetTagName() string GetTextContent() string SetTextContent(string) - GetTextLength() float64 + GetTextLength() int GetTitle() string SetTitle(string) ToggleAttribute(args ...interface{}) bool @@ -180,11 +180,11 @@ func (h HTMLTextAreaElement) CheckValidity(args ...interface{}) bool { val := h.Call("checkValidity", args...) return val.Bool() } -func (h HTMLTextAreaElement) GetCols() float64 { +func (h HTMLTextAreaElement) GetCols() int { val := h.Get("cols") - return val.Float() + return val.Int() } -func (h HTMLTextAreaElement) SetCols(val float64) { +func (h HTMLTextAreaElement) SetCols(val int) { h.Set("cols", val) } func (h HTMLTextAreaElement) GetDefaultValue() string { @@ -216,18 +216,18 @@ func (h HTMLTextAreaElement) GetLabels() NodeList { val := h.Get("labels") return JSValueToNodeList(val.JSValue()) } -func (h HTMLTextAreaElement) GetMaxLength() float64 { +func (h HTMLTextAreaElement) GetMaxLength() int { val := h.Get("maxLength") - return val.Float() + return val.Int() } -func (h HTMLTextAreaElement) SetMaxLength(val float64) { +func (h HTMLTextAreaElement) SetMaxLength(val int) { h.Set("maxLength", val) } -func (h HTMLTextAreaElement) GetMinLength() float64 { +func (h HTMLTextAreaElement) GetMinLength() int { val := h.Get("minLength") - return val.Float() + return val.Int() } -func (h HTMLTextAreaElement) SetMinLength(val float64) { +func (h HTMLTextAreaElement) SetMinLength(val int) { h.Set("minLength", val) } func (h HTMLTextAreaElement) GetName() string { @@ -262,11 +262,11 @@ func (h HTMLTextAreaElement) GetRequired() bool { func (h HTMLTextAreaElement) SetRequired(val bool) { h.Set("required", val) } -func (h HTMLTextAreaElement) GetRows() float64 { +func (h HTMLTextAreaElement) GetRows() int { val := h.Get("rows") - return val.Float() + return val.Int() } -func (h HTMLTextAreaElement) SetRows(val float64) { +func (h HTMLTextAreaElement) SetRows(val int) { h.Set("rows", val) } func (h HTMLTextAreaElement) Select(args ...interface{}) { @@ -279,18 +279,18 @@ func (h HTMLTextAreaElement) GetSelectionDirection() string { func (h HTMLTextAreaElement) SetSelectionDirection(val string) { h.Set("selectionDirection", val) } -func (h HTMLTextAreaElement) GetSelectionEnd() float64 { +func (h HTMLTextAreaElement) GetSelectionEnd() int { val := h.Get("selectionEnd") - return val.Float() + return val.Int() } -func (h HTMLTextAreaElement) SetSelectionEnd(val float64) { +func (h HTMLTextAreaElement) SetSelectionEnd(val int) { h.Set("selectionEnd", val) } -func (h HTMLTextAreaElement) GetSelectionStart() float64 { +func (h HTMLTextAreaElement) GetSelectionStart() int { val := h.Get("selectionStart") - return val.Float() + return val.Int() } -func (h HTMLTextAreaElement) SetSelectionStart(val float64) { +func (h HTMLTextAreaElement) SetSelectionStart(val int) { h.Set("selectionStart", val) } func (h HTMLTextAreaElement) SetCustomValidity(args ...interface{}) { @@ -305,9 +305,9 @@ func (h HTMLTextAreaElement) SetRangeTextWithArgs(args ...interface{}) { func (h HTMLTextAreaElement) SetSelectionRange(args ...interface{}) { h.Call("setSelectionRange", args...) } -func (h HTMLTextAreaElement) GetTextLength() float64 { +func (h HTMLTextAreaElement) GetTextLength() int { val := h.Get("textLength") - return val.Float() + return val.Int() } func (h HTMLTextAreaElement) GetType() string { val := h.Get("type") diff --git a/htmlvideoelement.go b/htmlvideoelement.go index 86d4fd1..248e54b 100644 --- a/htmlvideoelement.go +++ b/htmlvideoelement.go @@ -65,8 +65,8 @@ type HTMLVideoElementIFace interface { HasAttributeNS(args ...interface{}) bool HasAttributes(args ...interface{}) bool HasChildNodes(args ...interface{}) bool - GetHeight() float64 - SetHeight(float64) + GetHeight() int + SetHeight(int) GetHidden() bool SetHidden(bool) GetId() string @@ -148,14 +148,14 @@ type HTMLVideoElementIFace interface { ToggleAttribute(args ...interface{}) bool GetTranslate() bool SetTranslate(bool) - GetVideoHeight() float64 + GetVideoHeight() int GetVideoTracks() VideoTrackList - GetVideoWidth() float64 + GetVideoWidth() int GetVolume() float64 SetVolume(float64) WebkitMatchesSelector(args ...interface{}) bool - GetWidth() float64 - SetWidth(float64) + GetWidth() int + SetWidth(int) } type HTMLVideoElement struct { Value @@ -170,11 +170,11 @@ func JSValueToHTMLVideoElement(val js.Value) HTMLVideoElement { return HTMLVideoElement{Value: Value{Value: val}} } func (v Value) AsHTMLVideoElement() HTMLVideoElement { return HTMLVideoElement{Value: v} } -func (h HTMLVideoElement) GetHeight() float64 { +func (h HTMLVideoElement) GetHeight() int { val := h.Get("height") - return val.Float() + return val.Int() } -func (h HTMLVideoElement) SetHeight(val float64) { +func (h HTMLVideoElement) SetHeight(val int) { h.Set("height", val) } func (h HTMLVideoElement) GetPlaysInline() bool { @@ -191,18 +191,18 @@ func (h HTMLVideoElement) GetPoster() string { func (h HTMLVideoElement) SetPoster(val string) { h.Set("poster", val) } -func (h HTMLVideoElement) GetVideoHeight() float64 { +func (h HTMLVideoElement) GetVideoHeight() int { val := h.Get("videoHeight") - return val.Float() + return val.Int() } -func (h HTMLVideoElement) GetVideoWidth() float64 { +func (h HTMLVideoElement) GetVideoWidth() int { val := h.Get("videoWidth") - return val.Float() + return val.Int() } -func (h HTMLVideoElement) GetWidth() float64 { +func (h HTMLVideoElement) GetWidth() int { val := h.Get("width") - return val.Float() + return val.Int() } -func (h HTMLVideoElement) SetWidth(val float64) { +func (h HTMLVideoElement) SetWidth(val int) { h.Set("width", val) } diff --git a/imagebitmap.go b/imagebitmap.go index d4b63cf..397677c 100644 --- a/imagebitmap.go +++ b/imagebitmap.go @@ -6,8 +6,8 @@ import "syscall/js" type ImageBitmapIFace interface { Close(args ...interface{}) - GetHeight() float64 - GetWidth() float64 + GetHeight() int + GetWidth() int } type ImageBitmap struct { Value @@ -18,11 +18,11 @@ func (v Value) AsImageBitmap() ImageBitmap { return ImageBitmap{Value: func (i ImageBitmap) Close(args ...interface{}) { i.Call("close", args...) } -func (i ImageBitmap) GetHeight() float64 { +func (i ImageBitmap) GetHeight() int { val := i.Get("height") - return val.Float() + return val.Int() } -func (i ImageBitmap) GetWidth() float64 { +func (i ImageBitmap) GetWidth() int { val := i.Get("width") - return val.Float() + return val.Int() } diff --git a/imagedata.go b/imagedata.go index 86d8fd4..8c01c20 100644 --- a/imagedata.go +++ b/imagedata.go @@ -6,8 +6,8 @@ import "syscall/js" type ImageDataIFace interface { GetData() Uint8ClampedArray - GetHeight() float64 - GetWidth() float64 + GetHeight() int + GetWidth() int } type ImageData struct { Value @@ -19,11 +19,11 @@ func (i ImageData) GetData() Uint8ClampedArray { val := i.Get("data") return JSValueToUint8ClampedArray(val.JSValue()) } -func (i ImageData) GetHeight() float64 { +func (i ImageData) GetHeight() int { val := i.Get("height") - return val.Float() + return val.Int() } -func (i ImageData) GetWidth() float64 { +func (i ImageData) GetWidth() int { val := i.Get("width") - return val.Float() + return val.Int() } diff --git a/medialist.go b/medialist.go index fb4ae71..cc73e9f 100644 --- a/medialist.go +++ b/medialist.go @@ -8,7 +8,7 @@ type MediaListIFace interface { AppendMedium(args ...interface{}) DeleteMedium(args ...interface{}) Item(args ...interface{}) string - GetLength() float64 + GetLength() int GetMediaText() string SetMediaText(string) } @@ -28,9 +28,9 @@ func (m MediaList) Item(args ...interface{}) string { val := m.Call("item", args...) return val.String() } -func (m MediaList) GetLength() float64 { +func (m MediaList) GetLength() int { val := m.Get("length") - return val.Float() + return val.Int() } func (m MediaList) GetMediaText() string { val := m.Get("mediaText") diff --git a/mimetypearray.go b/mimetypearray.go index 89058d7..4d55fec 100644 --- a/mimetypearray.go +++ b/mimetypearray.go @@ -6,7 +6,7 @@ import "syscall/js" type MimeTypeArrayIFace interface { Item(args ...interface{}) MimeType - GetLength() float64 + GetLength() int NamedItem(args ...interface{}) MimeType } type MimeTypeArray struct { @@ -21,9 +21,9 @@ func (m MimeTypeArray) Item(args ...interface{}) MimeType { val := m.Call("item", args...) return JSValueToMimeType(val.JSValue()) } -func (m MimeTypeArray) GetLength() float64 { +func (m MimeTypeArray) GetLength() int { val := m.Get("length") - return val.Float() + return val.Int() } func (m MimeTypeArray) NamedItem(args ...interface{}) MimeType { val := m.Call("namedItem", args...) diff --git a/namednodemap.go b/namednodemap.go index 8647385..5864471 100644 --- a/namednodemap.go +++ b/namednodemap.go @@ -8,7 +8,7 @@ type NamedNodeMapIFace interface { GetNamedItem(args ...interface{}) Attr GetNamedItemNS(args ...interface{}) Attr Item(args ...interface{}) Attr - GetLength() float64 + GetLength() int RemoveNamedItem(args ...interface{}) Attr RemoveNamedItemNS(args ...interface{}) Attr SetNamedItem(args ...interface{}) Attr @@ -32,9 +32,9 @@ func (n NamedNodeMap) Item(args ...interface{}) Attr { val := n.Call("item", args...) return JSValueToAttr(val.JSValue()) } -func (n NamedNodeMap) GetLength() float64 { +func (n NamedNodeMap) GetLength() int { val := n.Get("length") - return val.Float() + return val.Int() } func (n NamedNodeMap) RemoveNamedItem(args ...interface{}) Attr { val := n.Call("removeNamedItem", args...) diff --git a/navigator.go b/navigator.go index c93390c..a9c9254 100644 --- a/navigator.go +++ b/navigator.go @@ -9,7 +9,7 @@ type NavigatorIFace interface { GetAppName() string GetAppVersion() string GetCookieEnabled() bool - GetHardwareConcurrency() float64 + GetHardwareConcurrency() int JavaEnabled(args ...interface{}) bool GetLanguage() string GetLanguages() @@ -48,9 +48,9 @@ func (n Navigator) GetCookieEnabled() bool { val := n.Get("cookieEnabled") return val.Bool() } -func (n Navigator) GetHardwareConcurrency() float64 { +func (n Navigator) GetHardwareConcurrency() int { val := n.Get("hardwareConcurrency") - return val.Float() + return val.Int() } func (n Navigator) JavaEnabled(args ...interface{}) bool { val := n.Call("javaEnabled", args...) diff --git a/nodefilter.go b/nodefilter.go index 17519c1..b1cd226 100644 --- a/nodefilter.go +++ b/nodefilter.go @@ -5,22 +5,22 @@ package dom import "syscall/js" const ( - NodeFilterFILTER_ACCEPT int = 1 - NodeFilterFILTER_REJECT int = 2 - NodeFilterFILTER_SKIP int = 3 - NodeFilterSHOW_ALL float64 = 0xFFFFFFFF - NodeFilterSHOW_ATTRIBUTE float64 = 0x2 - NodeFilterSHOW_CDATA_SECTION float64 = 0x8 - NodeFilterSHOW_COMMENT float64 = 0x80 - NodeFilterSHOW_DOCUMENT float64 = 0x100 - NodeFilterSHOW_DOCUMENT_FRAGMENT float64 = 0x400 - NodeFilterSHOW_DOCUMENT_TYPE float64 = 0x200 - NodeFilterSHOW_ELEMENT float64 = 0x1 - NodeFilterSHOW_ENTITY float64 = 0x20 - NodeFilterSHOW_ENTITY_REFERENCE float64 = 0x10 - NodeFilterSHOW_NOTATION float64 = 0x800 - NodeFilterSHOW_PROCESSING_INSTRUCTION float64 = 0x40 - NodeFilterSHOW_TEXT float64 = 0x4 + NodeFilterFILTER_ACCEPT int = 1 + NodeFilterFILTER_REJECT int = 2 + NodeFilterFILTER_SKIP int = 3 + NodeFilterSHOW_ALL int = 0xFFFFFFFF + NodeFilterSHOW_ATTRIBUTE int = 0x2 + NodeFilterSHOW_CDATA_SECTION int = 0x8 + NodeFilterSHOW_COMMENT int = 0x80 + NodeFilterSHOW_DOCUMENT int = 0x100 + NodeFilterSHOW_DOCUMENT_FRAGMENT int = 0x400 + NodeFilterSHOW_DOCUMENT_TYPE int = 0x200 + NodeFilterSHOW_ELEMENT int = 0x1 + NodeFilterSHOW_ENTITY int = 0x20 + NodeFilterSHOW_ENTITY_REFERENCE int = 0x10 + NodeFilterSHOW_NOTATION int = 0x800 + NodeFilterSHOW_PROCESSING_INSTRUCTION int = 0x40 + NodeFilterSHOW_TEXT int = 0x4 ) type NodeFilterAcceptNodeCallback func(node Node) diff --git a/nodeiterator.go b/nodeiterator.go index fc4a701..d34fb8c 100644 --- a/nodeiterator.go +++ b/nodeiterator.go @@ -12,7 +12,7 @@ type NodeIteratorIFace interface { PreviousNode(args ...interface{}) Node GetReferenceNode() Node GetRoot() Node - GetWhatToShow() float64 + GetWhatToShow() int } type NodeIterator struct { Value @@ -47,7 +47,7 @@ func (n NodeIterator) GetRoot() Node { val := n.Get("root") return JSValueToNode(val.JSValue()) } -func (n NodeIterator) GetWhatToShow() float64 { +func (n NodeIterator) GetWhatToShow() int { val := n.Get("whatToShow") - return val.Float() + return val.Int() } diff --git a/nodelist.go b/nodelist.go index 79e4bac..ba90ee2 100644 --- a/nodelist.go +++ b/nodelist.go @@ -6,7 +6,7 @@ import "syscall/js" type NodeListIFace interface { Item(args ...interface{}) Node - GetLength() float64 + GetLength() int } type NodeList struct { Value @@ -18,7 +18,7 @@ func (n NodeList) Item(args ...interface{}) Node { val := n.Call("item", args...) return JSValueToNode(val.JSValue()) } -func (n NodeList) GetLength() float64 { +func (n NodeList) GetLength() int { val := n.Get("length") - return val.Float() + return val.Int() } diff --git a/offscreencanvas.go b/offscreencanvas.go index 4051080..8e99cce 100644 --- a/offscreencanvas.go +++ b/offscreencanvas.go @@ -9,12 +9,12 @@ type OffscreenCanvasIFace interface { ConvertToBlob(args ...interface{}) DispatchEvent(args ...interface{}) bool GetContext(args ...interface{}) OffscreenRenderingContext - GetHeight() float64 - SetHeight(float64) + GetHeight() int + SetHeight(int) RemoveEventListener(args ...interface{}) TransferToImageBitmap(args ...interface{}) ImageBitmap - GetWidth() float64 - SetWidth(float64) + GetWidth() int + SetWidth(int) } type OffscreenCanvas struct { Value @@ -32,21 +32,21 @@ func (o OffscreenCanvas) GetContext(args ...interface{}) OffscreenRenderingConte val := o.Call("getContext", args...) return JSValueToOffscreenRenderingContext(val.JSValue()) } -func (o OffscreenCanvas) GetHeight() float64 { +func (o OffscreenCanvas) GetHeight() int { val := o.Get("height") - return val.Float() + return val.Int() } -func (o OffscreenCanvas) SetHeight(val float64) { +func (o OffscreenCanvas) SetHeight(val int) { o.Set("height", val) } func (o OffscreenCanvas) TransferToImageBitmap(args ...interface{}) ImageBitmap { val := o.Call("transferToImageBitmap", args...) return JSValueToImageBitmap(val.JSValue()) } -func (o OffscreenCanvas) GetWidth() float64 { +func (o OffscreenCanvas) GetWidth() int { val := o.Get("width") - return val.Float() + return val.Int() } -func (o OffscreenCanvas) SetWidth(val float64) { +func (o OffscreenCanvas) SetWidth(val int) { o.Set("width", val) } diff --git a/onerroreventhandlernonnull.go b/onerroreventhandlernonnull.go index 53918d4..010229e 100644 --- a/onerroreventhandlernonnull.go +++ b/onerroreventhandlernonnull.go @@ -4,7 +4,7 @@ package dom import "syscall/js" -type OnErrorEventHandlerNonNullCallback func(event Value, source string, lineno float64, colno float64, error Value) Value +type OnErrorEventHandlerNonNullCallback func(event Value, source string, lineno int, colno int, error Value) Value type OnErrorEventHandlerNonNull struct { Callback } @@ -16,8 +16,8 @@ func NewOnErrorEventHandlerNonNull(c OnErrorEventHandlerNonNullCallback) OnError callback := js.NewCallback(func(args []js.Value) { event := JSValueToValue(args[0]) source := args[1].String() - lineno := args[2].Float() - colno := args[3].Float() + lineno := args[2].Int() + colno := args[3].Int() error := JSValueToValue(args[4]) c(event, source, lineno, colno, error) }) diff --git a/plugin.go b/plugin.go index 7d661c8..20ccc41 100644 --- a/plugin.go +++ b/plugin.go @@ -8,7 +8,7 @@ type PluginIFace interface { GetDescription() string GetFilename() string Item(args ...interface{}) MimeType - GetLength() float64 + GetLength() int GetName() string NamedItem(args ...interface{}) MimeType } @@ -30,9 +30,9 @@ func (p Plugin) Item(args ...interface{}) MimeType { val := p.Call("item", args...) return JSValueToMimeType(val.JSValue()) } -func (p Plugin) GetLength() float64 { +func (p Plugin) GetLength() int { val := p.Get("length") - return val.Float() + return val.Int() } func (p Plugin) GetName() string { val := p.Get("name") diff --git a/pluginarray.go b/pluginarray.go index 5d8137a..80e9027 100644 --- a/pluginarray.go +++ b/pluginarray.go @@ -6,7 +6,7 @@ import "syscall/js" type PluginArrayIFace interface { Item(args ...interface{}) Plugin - GetLength() float64 + GetLength() int NamedItem(args ...interface{}) Plugin Refresh(args ...interface{}) } @@ -20,9 +20,9 @@ func (p PluginArray) Item(args ...interface{}) Plugin { val := p.Call("item", args...) return JSValueToPlugin(val.JSValue()) } -func (p PluginArray) GetLength() float64 { +func (p PluginArray) GetLength() int { val := p.Get("length") - return val.Float() + return val.Int() } func (p PluginArray) NamedItem(args ...interface{}) Plugin { val := p.Call("namedItem", args...) diff --git a/processinginstruction.go b/processinginstruction.go index b3929dc..3410967 100644 --- a/processinginstruction.go +++ b/processinginstruction.go @@ -27,7 +27,7 @@ type ProcessingInstructionIFace interface { IsEqualNode(args ...interface{}) bool IsSameNode(args ...interface{}) bool GetLastChild() Node - GetLength() float64 + GetLength() int LookupNamespaceURI(args ...interface{}) string LookupPrefix(args ...interface{}) string GetNextSibling() Node diff --git a/progressevent.go b/progressevent.go index 3969d12..6ef2008 100644 --- a/progressevent.go +++ b/progressevent.go @@ -17,7 +17,7 @@ type ProgressEventIFace interface { InitEvent(args ...interface{}) GetIsTrusted() bool GetLengthComputable() bool - GetLoaded() float64 + GetLoaded() int PreventDefault(args ...interface{}) GetReturnValue() bool SetReturnValue(bool) @@ -26,7 +26,7 @@ type ProgressEventIFace interface { StopPropagation(args ...interface{}) GetTarget() EventTarget GetTimeStamp() DOMHighResTimeStamp - GetTotal() float64 + GetTotal() int GetType() string } type ProgressEvent struct { @@ -42,11 +42,11 @@ func (p ProgressEvent) GetLengthComputable() bool { val := p.Get("lengthComputable") return val.Bool() } -func (p ProgressEvent) GetLoaded() float64 { +func (p ProgressEvent) GetLoaded() int { val := p.Get("loaded") - return val.Float() + return val.Int() } -func (p ProgressEvent) GetTotal() float64 { +func (p ProgressEvent) GetTotal() int { val := p.Get("total") - return val.Float() + return val.Int() } diff --git a/radionodelist.go b/radionodelist.go index 7d1ef26..7c26830 100644 --- a/radionodelist.go +++ b/radionodelist.go @@ -6,7 +6,7 @@ import "syscall/js" type RadioNodeListIFace interface { Item(args ...interface{}) Node - GetLength() float64 + GetLength() int GetValue() string SetValue(string) } diff --git a/range.go b/range.go index 909aeda..83e7dea 100644 --- a/range.go +++ b/range.go @@ -15,7 +15,7 @@ type RangeIFace interface { DeleteContents(args ...interface{}) Detach(args ...interface{}) GetEndContainer() Node - GetEndOffset() float64 + GetEndOffset() int ExtractContents(args ...interface{}) DocumentFragment InsertNode(args ...interface{}) IntersectsNode(args ...interface{}) bool @@ -29,7 +29,7 @@ type RangeIFace interface { SetStartAfter(args ...interface{}) SetStartBefore(args ...interface{}) GetStartContainer() Node - GetStartOffset() float64 + GetStartOffset() int SurroundContents(args ...interface{}) } type Range struct { diff --git a/staticrange.go b/staticrange.go index b4d45bb..829cf18 100644 --- a/staticrange.go +++ b/staticrange.go @@ -7,9 +7,9 @@ import "syscall/js" type StaticRangeIFace interface { GetCollapsed() bool GetEndContainer() Node - GetEndOffset() float64 + GetEndOffset() int GetStartContainer() Node - GetStartOffset() float64 + GetStartOffset() int } type StaticRange struct { Value diff --git a/storage.go b/storage.go index 415d613..4fbc1ec 100644 --- a/storage.go +++ b/storage.go @@ -8,7 +8,7 @@ type StorageIFace interface { Clear(args ...interface{}) GetItem(args ...interface{}) string Key(args ...interface{}) string - GetLength() float64 + GetLength() int RemoveItem(args ...interface{}) SetItem(args ...interface{}) } @@ -29,9 +29,9 @@ func (s Storage) Key(args ...interface{}) string { val := s.Call("key", args...) return val.String() } -func (s Storage) GetLength() float64 { +func (s Storage) GetLength() int { val := s.Get("length") - return val.Float() + return val.Int() } func (s Storage) RemoveItem(args ...interface{}) { s.Call("removeItem", args...) diff --git a/stylesheetlist.go b/stylesheetlist.go index 7ffb647..6f9ab5e 100644 --- a/stylesheetlist.go +++ b/stylesheetlist.go @@ -6,7 +6,7 @@ import "syscall/js" type StyleSheetListIFace interface { Item(args ...interface{}) StyleSheet - GetLength() float64 + GetLength() int } type StyleSheetList struct { Value @@ -20,7 +20,7 @@ func (s StyleSheetList) Item(args ...interface{}) StyleSheet { val := s.Call("item", args...) return JSValueToStyleSheet(val.JSValue()) } -func (s StyleSheetList) GetLength() float64 { +func (s StyleSheetList) GetLength() int { val := s.Get("length") - return val.Float() + return val.Int() } diff --git a/text.go b/text.go index 410ccfb..a020a6f 100644 --- a/text.go +++ b/text.go @@ -28,7 +28,7 @@ type TextIFace interface { IsEqualNode(args ...interface{}) bool IsSameNode(args ...interface{}) bool GetLastChild() Node - GetLength() float64 + GetLength() int LookupNamespaceURI(args ...interface{}) string LookupPrefix(args ...interface{}) string GetNextSibling() Node diff --git a/texttrackcuelist.go b/texttrackcuelist.go index baf161a..9275202 100644 --- a/texttrackcuelist.go +++ b/texttrackcuelist.go @@ -6,7 +6,7 @@ import "syscall/js" type TextTrackCueListIFace interface { GetCueById(args ...interface{}) TextTrackCue - GetLength() float64 + GetLength() int } type TextTrackCueList struct { Value @@ -20,7 +20,7 @@ func (t TextTrackCueList) GetCueById(args ...interface{}) TextTrackCue { val := t.Call("getCueById", args...) return JSValueToTextTrackCue(val.JSValue()) } -func (t TextTrackCueList) GetLength() float64 { +func (t TextTrackCueList) GetLength() int { val := t.Get("length") - return val.Float() + return val.Int() } diff --git a/texttracklist.go b/texttracklist.go index 8d4c5a0..ab1ad16 100644 --- a/texttracklist.go +++ b/texttracklist.go @@ -8,7 +8,7 @@ type TextTrackListIFace interface { AddEventListener(args ...interface{}) DispatchEvent(args ...interface{}) bool GetTrackById(args ...interface{}) TextTrack - GetLength() float64 + GetLength() int GetOnaddtrack() EventHandler SetOnaddtrack(EventHandler) GetOnchange() EventHandler @@ -30,9 +30,9 @@ func (t TextTrackList) GetTrackById(args ...interface{}) TextTrack { val := t.Call("getTrackById", args...) return JSValueToTextTrack(val.JSValue()) } -func (t TextTrackList) GetLength() float64 { +func (t TextTrackList) GetLength() int { val := t.Get("length") - return val.Float() + return val.Int() } func (t TextTrackList) GetOnaddtrack() EventHandler { val := t.Get("onaddtrack") diff --git a/timeranges.go b/timeranges.go index 4b954b7..9f2aaf4 100644 --- a/timeranges.go +++ b/timeranges.go @@ -6,7 +6,7 @@ import "syscall/js" type TimeRangesIFace interface { End(args ...interface{}) float64 - GetLength() float64 + GetLength() int Start(args ...interface{}) float64 } type TimeRanges struct { @@ -19,9 +19,9 @@ func (t TimeRanges) End(args ...interface{}) float64 { val := t.Call("end", args...) return val.Float() } -func (t TimeRanges) GetLength() float64 { +func (t TimeRanges) GetLength() int { val := t.Get("length") - return val.Float() + return val.Int() } func (t TimeRanges) Start(args ...interface{}) float64 { val := t.Call("start", args...) diff --git a/treewalker.go b/treewalker.go index 0783824..1974fe6 100644 --- a/treewalker.go +++ b/treewalker.go @@ -16,7 +16,7 @@ type TreeWalkerIFace interface { PreviousNode(args ...interface{}) Node PreviousSibling(args ...interface{}) Node GetRoot() Node - GetWhatToShow() float64 + GetWhatToShow() int } type TreeWalker struct { Value @@ -67,7 +67,7 @@ func (t TreeWalker) GetRoot() Node { val := t.Get("root") return JSValueToNode(val.JSValue()) } -func (t TreeWalker) GetWhatToShow() float64 { +func (t TreeWalker) GetWhatToShow() int { val := t.Get("whatToShow") - return val.Float() + return val.Int() } diff --git a/value.go b/value.go index 56c8722..a47a653 100644 --- a/value.go +++ b/value.go @@ -16,11 +16,28 @@ func (v Value) JSValue() js.Value { return v.Value } func (v Value) Get(p string) Value { return JSValueToValue(v.Value.Get(p)) } func (v Value) Index(i int) Value { return JSValueToValue(v.Value.Index(i)) } func (v Value) Call(m string, args ...interface{}) Value { + for i, a := range args { + args[i] = GetJSValue(a) + } return JSValueToValue(v.Value.Call(m, args...)) } func (v Value) Invoke(args ...interface{}) Value { + for i, a := range args { + args[i] = GetJSValue(a) + } return JSValueToValue(v.Value.Invoke(args...)) } func (v Value) New(args ...interface{}) Value { + for i, a := range args { + args[i] = GetJSValue(a) + } return JSValueToValue(v.Value.New(args...)) } + +func GetJSValue(v interface{}) interface{} { + t, ok := v.(JSValue) + if ok { + return t.JSValue() + } + return v +} diff --git a/videotracklist.go b/videotracklist.go index fce483c..3ec5a39 100644 --- a/videotracklist.go +++ b/videotracklist.go @@ -8,7 +8,7 @@ type VideoTrackListIFace interface { AddEventListener(args ...interface{}) DispatchEvent(args ...interface{}) bool GetTrackById(args ...interface{}) VideoTrack - GetLength() float64 + GetLength() int GetOnaddtrack() EventHandler SetOnaddtrack(EventHandler) GetOnchange() EventHandler @@ -16,7 +16,7 @@ type VideoTrackListIFace interface { GetOnremovetrack() EventHandler SetOnremovetrack(EventHandler) RemoveEventListener(args ...interface{}) - GetSelectedIndex() float64 + GetSelectedIndex() int } type VideoTrackList struct { Value @@ -31,9 +31,9 @@ func (v VideoTrackList) GetTrackById(args ...interface{}) VideoTrack { val := v.Call("getTrackById", args...) return JSValueToVideoTrack(val.JSValue()) } -func (v VideoTrackList) GetLength() float64 { +func (v VideoTrackList) GetLength() int { val := v.Get("length") - return val.Float() + return val.Int() } func (v VideoTrackList) GetOnaddtrack() EventHandler { val := v.Get("onaddtrack") @@ -56,7 +56,7 @@ func (v VideoTrackList) GetOnremovetrack() EventHandler { func (v VideoTrackList) SetOnremovetrack(val EventHandler) { v.Set("onremovetrack", val) } -func (v VideoTrackList) GetSelectedIndex() float64 { +func (v VideoTrackList) GetSelectedIndex() int { val := v.Get("selectedIndex") - return val.Float() + return val.Int() } diff --git a/websocket.go b/websocket.go index 6bdedff..4545263 100644 --- a/websocket.go +++ b/websocket.go @@ -8,7 +8,7 @@ type WebSocketIFace interface { AddEventListener(args ...interface{}) GetBinaryType() BinaryType SetBinaryType(BinaryType) - GetBufferedAmount() float64 + GetBufferedAmount() int Close(args ...interface{}) DispatchEvent(args ...interface{}) bool GetExtensions() string @@ -43,9 +43,9 @@ func (w WebSocket) GetBinaryType() BinaryType { func (w WebSocket) SetBinaryType(val BinaryType) { w.Set("binaryType", val) } -func (w WebSocket) GetBufferedAmount() float64 { +func (w WebSocket) GetBufferedAmount() int { val := w.Get("bufferedAmount") - return val.Float() + return val.Int() } func (w WebSocket) Close(args ...interface{}) { w.Call("close", args...) diff --git a/window.go b/window.go index 648f734..436e82f 100644 --- a/window.go +++ b/window.go @@ -27,7 +27,7 @@ type WindowIFace interface { GetFrameElement() Element GetFrames() WindowProxy GetHistory() History - GetLength() float64 + GetLength() int GetLocalStorage() Storage GetLocation() Location GetLocationbar() BarProp @@ -202,12 +202,12 @@ type WindowIFace interface { Prompt(args ...interface{}) string QueueMicrotask(args ...interface{}) RemoveEventListener(args ...interface{}) - RequestAnimationFrame(args ...interface{}) float64 + RequestAnimationFrame(args ...interface{}) int GetScrollbars() BarProp GetSelf() WindowProxy GetSessionStorage() Storage - SetInterval(args ...interface{}) float64 - SetTimeout(args ...interface{}) float64 + SetInterval(args ...interface{}) int + SetTimeout(args ...interface{}) int GetStatus() string SetStatus(string) GetStatusbar() BarProp @@ -293,9 +293,9 @@ func (w Window) GetHistory() History { val := w.Get("history") return JSValueToHistory(val.JSValue()) } -func (w Window) GetLength() float64 { +func (w Window) GetLength() int { val := w.Get("length") - return val.Float() + return val.Int() } func (w Window) GetLocalStorage() Storage { val := w.Get("localStorage") @@ -906,9 +906,9 @@ func (w Window) Prompt(args ...interface{}) string { func (w Window) QueueMicrotask(args ...interface{}) { w.Call("queueMicrotask", args...) } -func (w Window) RequestAnimationFrame(args ...interface{}) float64 { +func (w Window) RequestAnimationFrame(args ...interface{}) int { val := w.Call("requestAnimationFrame", args...) - return val.Float() + return val.Int() } func (w Window) GetScrollbars() BarProp { val := w.Get("scrollbars") @@ -922,13 +922,13 @@ func (w Window) GetSessionStorage() Storage { val := w.Get("sessionStorage") return JSValueToStorage(val.JSValue()) } -func (w Window) SetInterval(args ...interface{}) float64 { +func (w Window) SetInterval(args ...interface{}) int { val := w.Call("setInterval", args...) - return val.Float() + return val.Int() } -func (w Window) SetTimeout(args ...interface{}) float64 { +func (w Window) SetTimeout(args ...interface{}) int { val := w.Call("setTimeout", args...) - return val.Float() + return val.Int() } func (w Window) GetStatus() string { val := w.Get("status") diff --git a/window/window.go b/window/window.go index 2113822..7655f42 100644 --- a/window/window.go +++ b/window/window.go @@ -2,7 +2,7 @@ // window/window.go package window -import dom "github.com/brettlangdon/go-dom/v1" +import dom "github.com/brettlangdon/go-dom" import "syscall/js" var value dom.Window @@ -78,7 +78,7 @@ func GetFrames() dom.WindowProxy { func GetHistory() dom.History { return value.GetHistory() } -func GetLength() float64 { +func GetLength() int { return value.GetLength() } func GetLocalStorage() dom.Storage { @@ -445,9 +445,9 @@ func QueueMicrotask(args ...interface{}) { func RemoveEventListener(args ...interface{}) { value.Call("removeEventListener", args...) } -func RequestAnimationFrame(args ...interface{}) float64 { +func RequestAnimationFrame(args ...interface{}) int { val := value.Call("requestAnimationFrame", args...) - return val.Float() + return val.Int() } func GetScrollbars() dom.BarProp { return value.GetScrollbars() @@ -458,13 +458,13 @@ func GetSelf() dom.WindowProxy { func GetSessionStorage() dom.Storage { return value.GetSessionStorage() } -func SetInterval(args ...interface{}) float64 { +func SetInterval(args ...interface{}) int { val := value.Call("setInterval", args...) - return val.Float() + return val.Int() } -func SetTimeout(args ...interface{}) float64 { +func SetTimeout(args ...interface{}) int { val := value.Call("setTimeout", args...) - return val.Float() + return val.Int() } func GetStatus() string { return value.GetStatus() diff --git a/workerglobalscope.go b/workerglobalscope.go index 10ca275..0419f6a 100644 --- a/workerglobalscope.go +++ b/workerglobalscope.go @@ -32,8 +32,8 @@ type WorkerGlobalScopeIFace interface { QueueMicrotask(args ...interface{}) RemoveEventListener(args ...interface{}) GetSelf() WorkerGlobalScope - SetInterval(args ...interface{}) float64 - SetTimeout(args ...interface{}) float64 + SetInterval(args ...interface{}) int + SetTimeout(args ...interface{}) int } type WorkerGlobalScope struct { Value @@ -128,11 +128,11 @@ func (w WorkerGlobalScope) GetSelf() WorkerGlobalScope { val := w.Get("self") return JSValueToWorkerGlobalScope(val.JSValue()) } -func (w WorkerGlobalScope) SetInterval(args ...interface{}) float64 { +func (w WorkerGlobalScope) SetInterval(args ...interface{}) int { val := w.Call("setInterval", args...) - return val.Float() + return val.Int() } -func (w WorkerGlobalScope) SetTimeout(args ...interface{}) float64 { +func (w WorkerGlobalScope) SetTimeout(args ...interface{}) int { val := w.Call("setTimeout", args...) - return val.Float() + return val.Int() } diff --git a/workernavigator.go b/workernavigator.go index 5a9b04e..97564c6 100644 --- a/workernavigator.go +++ b/workernavigator.go @@ -8,7 +8,7 @@ type WorkerNavigatorIFace interface { GetAppCodeName() string GetAppName() string GetAppVersion() string - GetHardwareConcurrency() float64 + GetHardwareConcurrency() int GetLanguage() string GetLanguages() GetOnLine() bool @@ -40,9 +40,9 @@ func (w WorkerNavigator) GetAppVersion() string { val := w.Get("appVersion") return val.String() } -func (w WorkerNavigator) GetHardwareConcurrency() float64 { +func (w WorkerNavigator) GetHardwareConcurrency() int { val := w.Get("hardwareConcurrency") - return val.Float() + return val.Int() } func (w WorkerNavigator) GetLanguage() string { val := w.Get("language") diff --git a/xmlhttprequest.go b/xmlhttprequest.go index d82cd4d..a5a7fdb 100644 --- a/xmlhttprequest.go +++ b/xmlhttprequest.go @@ -41,8 +41,8 @@ type XMLHttpRequestIFace interface { SetRequestHeader(args ...interface{}) GetStatus() int GetStatusText() []byte - GetTimeout() float64 - SetTimeout(float64) + GetTimeout() int + SetTimeout(int) GetUpload() XMLHttpRequestUpload GetWithCredentials() bool SetWithCredentials(bool) @@ -125,11 +125,11 @@ func (x XMLHttpRequest) GetStatusText() []byte { val := x.Get("statusText") return []byte(val.String()) } -func (x XMLHttpRequest) GetTimeout() float64 { +func (x XMLHttpRequest) GetTimeout() int { val := x.Get("timeout") - return val.Float() + return val.Int() } -func (x XMLHttpRequest) SetTimeout(val float64) { +func (x XMLHttpRequest) SetTimeout(val int) { x.Set("timeout", val) } func (x XMLHttpRequest) GetUpload() XMLHttpRequestUpload {