{"id":16584535,"url":"https://github.com/brettlangdon/go-dom","last_synced_at":"2025-10-29T08:30:24.122Z","repository":{"id":57517846,"uuid":"150005938","full_name":"brettlangdon/go-dom","owner":"brettlangdon","description":"Web API package for use when compling Go to WASM","archived":false,"fork":false,"pushed_at":"2018-09-25T13:44:33.000Z","size":426,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T23:51:03.530Z","etag":null,"topics":["dom","go","golang","wasm","web","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brettlangdon.png","metadata":{"files":{"readme":"README.md","changelog":"history.go","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-23T17:00:41.000Z","updated_at":"2023-05-08T05:52:05.000Z","dependencies_parsed_at":"2022-09-06T08:03:01.698Z","dependency_job_id":null,"html_url":"https://github.com/brettlangdon/go-dom","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brettlangdon%2Fgo-dom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brettlangdon%2Fgo-dom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brettlangdon%2Fgo-dom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brettlangdon%2Fgo-dom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brettlangdon","download_url":"https://codeload.github.com/brettlangdon/go-dom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238791895,"owners_count":19531027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["dom","go","golang","wasm","web","webassembly"],"created_at":"2024-10-11T22:44:53.215Z","updated_at":"2025-10-29T08:30:18.332Z","avatar_url":"https://github.com/brettlangdon.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-dom\n------\n\n**This package is a work in progress**\n\nThe `go-dom` package exposes the [Web API Spec](https://spec.whatwg.org/) as a Go package.\n\nThis package is mostly just wrappers around calls to [syscall/js](https://tip.golang.org/pkg/syscall/js/)\nto expose the browser Web API in a Go friendly manner.\n\nThis package's code is generated from [WebIDL](https://heycam.github.io/webidl/) definitions for the various Web API Specs.\n\n## Examples\n\nThese examples can be compiled and run using `GOARCH=wasm GOOS=js` as described at https://github.com/golang/go/wiki/WebAssembly\n\nFind all `div` elements and print them to the console\n\n```go\npackage main\n\nimport (\n    \"github.com/brettlangdon/go-dom/console\"\n    \"github.com/brettlangdon/go-dom/document\"\n)\n\nfunc main() {\n    nodes := document.QuerySelectorAll(\"div\")\n    for i := 0; i \u003c nodes.GetLength(); i++ {\n        console.Dir(nodes.Item(0))\n    }\n}\n```\n\nAdd a `click` handler to `document` which prints the event information.\n\n```go\npackage main\n\nimport (\n    dom \"github.com/brettlangdon/go-dom\"\n    \"github.com/brettlangdon/go-dom/console\"\n    \"github.com/brettlangdon/go-dom/document\"\n)\n\nfunc main() {\n    loop := dom.NewLoop()\n\n    document.AddEventListener(\"click\", dom.NewEventHandler(func(evt dom.Event) {\n        console.Dir(evt)\n    }))\n\n    loop.Loop()\n}\n```\n\nThis last example uses a `dom.Loop` which is used to keep the program running instead of exiting.\n\nIf the Go program exits then the callback handlers will no longer execute.\n\nCalling `loop.Stop()` will cause the Go program to exit.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrettlangdon%2Fgo-dom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrettlangdon%2Fgo-dom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrettlangdon%2Fgo-dom/lists"}