{"id":36812260,"url":"https://github.com/gowebapi/webidl-bind","last_synced_at":"2026-01-12T13:50:24.059Z","repository":{"id":45061927,"uuid":"169536668","full_name":"gowebapi/webidl-bind","owner":"gowebapi","description":"Code binding generator for Web Assembly from WebIDL","archived":false,"fork":false,"pushed_at":"2022-12-01T19:30:37.000Z","size":257,"stargazers_count":15,"open_issues_count":7,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-19T03:10:11.719Z","etag":null,"topics":["binder","golang","wasm"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gowebapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-07T07:52:06.000Z","updated_at":"2024-04-16T15:12:43.000Z","dependencies_parsed_at":"2023-01-22T19:15:11.733Z","dependency_job_id":null,"html_url":"https://github.com/gowebapi/webidl-bind","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gowebapi/webidl-bind","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gowebapi%2Fwebidl-bind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gowebapi%2Fwebidl-bind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gowebapi%2Fwebidl-bind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gowebapi%2Fwebidl-bind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gowebapi","download_url":"https://codeload.github.com/gowebapi/webidl-bind/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gowebapi%2Fwebidl-bind/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28339542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binder","golang","wasm"],"created_at":"2026-01-12T13:50:23.968Z","updated_at":"2026-01-12T13:50:24.042Z","avatar_url":"https://github.com/gowebapi.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Code binding generator for Web Assembly from WebIDL\n\nThis is a code generator that is taking WebIDL file and create binding code.\nIt can currently generate DOM/HTML bindings for Go Web Assembly.\n\n## Target Languages\n\n* Go 1.12 Web Assembly - Initail support\n\nCurrent no other languages is planned. Contributions are welcome :)\n\n## Input files\n\nThe hardest part is not to write a WebIDL from a specification, but keeping it up to date. The philosophy is extract webidl from a third source, e.g. by taking all IDL part from the DOM specification (\u003chttps://dom.spec.whatwg.org)\u003e and having all the modifications in other files.\n\nThe program need following input files:\n\n* foo.idl - Main WebIDL file, a \"1:1\" copy of the specification.\n* foo.addition.idl - Extra types and oddity that exist in the specification. E.g. the SVG IDL are refering to DOMRect that doesn't exist anywhere.\n* foo.go.md - Language transformation file. To modify incoming WebIDL and turning it into something thats look like a \"standard library\"\n* foo.doc.md - (Planned) API documentation file\n\n## Status/TODO\n\nCurrently the generator can process the DOM and HTML specification and create a compilable output. There are still missing feature, see [Go WASM](gowasm.md) for details.\n\n## WebIDL\n\nWebIDL specification can be found at \u003chttps://heycam.github.io/webidl/\u003e\n\n### Global scope\n\nThe specification files doesn't containts browsers global varibale scope, e.g. access to _window_. This can be defined with a special annotation _OnGlobalScope_ on a interface be able to define this methods and attributes. Please note that all attributes and methods need to be defined static to get correctly compilable code.\n\n```webidl\n[OnGlobalScope]\ninterface GlobalScope {\n    // access to javascript document variable.\n    static readonly attribute Document document;\n    // access to javascript window variable.\n    static readonly attribute Window window;\n};\n```\n\n\u003e Note: in the above example, to generator will create a function named Document() to get the document attribute. This will name clash with the interface Document. This is fixed by the language transformation file that is renaming the attribute in the final lanaguage.\n\n## Language transformation file\n\nThe transformation file are used to fix issues to get a final output that feels more \"natrual\" than working with raw generated files. Examples:\n\n* Method and constant rename. Go doesn't have support for static methods and constants , javascript does. Any static methods writted outside of the structure and this can leed to name clash if two interfaces define the same static method.\n* Enum value rename, e.g. by turning notification api \"ltr\" to LeftToRight.\n* Move interfaces to other packages. DOM and HTML specification have cirular dependency between them, some interfaces/methods need to be moved to get a compilable output.\n\nCurrent format using MarkDown ending to get some IDE syntax highlightning. With the exception for header tags (##), no other MarkDown synta is supported.\n\n```markdown\n\n# Initail header have no meaning\n\n    Any line starting with tab or spaces is consider to be a comment line\n\n## Foo (\"WebIDL type name\")\n\n    any line starting with a dot is modificing properties on type it self, e.g. rename the type to Bar\n\n.name = Bar\n\n    any other lines with equal sign is renaming method or attributes to target lanaguage name.\nmethodName = languageName\n\n    Developers need to invoke SayHelloWorld() in target language to trigger helloWorld() in javascript.\nhelloWorld = SayHelloWorld\n\n```\n\n### Callback\n\n|Syntax Name|Description|Default|\n|-----------|-----------|-------|\n|.package|package name|first part of the input file|\n|.name|type output name|idl type name in public access format|\n\n### Dictionary\n\n|Syntax Name|Description|Default|\n|-----------|-----------|-------|\n|.package|package name|first part of the input file|\n|.name|type output name|idl type name in public access format|\n\n### Enum\n\n|Syntax Name|Description|Default|\n|-----------|-----------|-------|\n|.package|package name|first part of the input file|\n|.name|type output name|idl type name in public access format|\n|.prefix|prefix that is added to every enum value|nothing|\n|.suffix|suffix that is added to every enum value|enum name|\n\n### Interface\n\nInterfaces have following properites\n\n|Syntax Name|Description|Default|\n|-----------|-----------|-------|\n|.package|package name|first part of the input file|\n|.name|type output name|idl type name in public access format|\n|.constPrefix|a prefix added to all type constants|empty|\n|.constSuffix|a suffix added to all type constants|interface name|\n|.constructorName|name of constructor|\"New\" + instance name|\n|.index-getter|name for 'getter' method with integer index|Index|\n|.index-setter|name for 'setter' method with integer index|SetIndex|\n|.key-getter|name for 'getter' method with string key|Get|\n|.key-setter|name for 'setter' method with string key|Set|\n|.key-deleter|name for 'deleter' method with string key|Delete|\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgowebapi%2Fwebidl-bind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgowebapi%2Fwebidl-bind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgowebapi%2Fwebidl-bind/lists"}