{"id":13413019,"url":"https://github.com/gopherjs/gopherjs","last_synced_at":"2026-04-02T02:16:57.433Z","repository":{"id":10297796,"uuid":"12418999","full_name":"gopherjs/gopherjs","owner":"gopherjs","description":"A compiler from Go to JavaScript for running Go code in a browser","archived":false,"fork":false,"pushed_at":"2025-12-05T16:56:48.000Z","size":7862,"stargazers_count":13081,"open_issues_count":189,"forks_count":569,"subscribers_count":237,"default_branch":"master","last_synced_at":"2025-12-08T07:55:03.384Z","etag":null,"topics":["compiler","go","golang","hacktoberfest","javascript"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mightybyte/map-syntax","license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gopherjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2013-08-27T22:23:58.000Z","updated_at":"2025-12-07T09:00:51.000Z","dependencies_parsed_at":"2023-07-13T09:24:23.776Z","dependency_job_id":"767031e7-f933-4173-a050-6c6dab67932e","html_url":"https://github.com/gopherjs/gopherjs","commit_stats":{"total_commits":2528,"total_committers":75,"mean_commits":33.70666666666666,"dds":0.370253164556962,"last_synced_commit":"8a2734845f9b7a4a3f7ec6b0529c802c3b798233"},"previous_names":["neelance/gopherjs"],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/gopherjs/gopherjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gopherjs%2Fgopherjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gopherjs%2Fgopherjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gopherjs%2Fgopherjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gopherjs%2Fgopherjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gopherjs","download_url":"https://codeload.github.com/gopherjs/gopherjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gopherjs%2Fgopherjs/sbom","scorecard":{"id":30895,"data":{"date":"2025-08-04","repo":{"name":"github.com/gopherjs/gopherjs","commit":"a87964c08abf7d233f34bb972eb5d88c1e261332"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":6.4,"checks":[{"name":"Maintained","score":10,"reason":"19 commit(s) and 10 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:143: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:192: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:215: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:81: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:101: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:104: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/ci.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yaml:108: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:125: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/measure-size.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/measure-size.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/measure-size.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/measure-size.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/measure-size.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/measure-size.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/measure-size.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/measure-size.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish-size.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/gopherjs/gopherjs/publish-size.yml/master?enable=pin","Warn: goCommand not pinned by hash: tests/gopherjsvendored_test.sh:53","Warn: goCommand not pinned by hash: .github/workflows/ci.yaml:158","Info:   0 out of  12 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned","Info:   0 out of   2 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/ci.yaml:10","Info: topLevel 'pull-requests' permission set to 'read': .github/workflows/ci.yaml:11","Warn: no topLevel permission defined: .github/workflows/measure-size.yml:1","Warn: no topLevel permission defined: .github/workflows/publish-size.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Fuzzing","score":10,"reason":"project is fuzzed","details":["Info: GoBuiltInFuzzer integration found: compiler/natives/src/image/gif/fuzz_test.go:8"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T19:05:30.652Z","repository_id":10297796,"created_at":"2025-08-14T19:05:30.652Z","updated_at":"2025-08-14T19:05:30.652Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27656640,"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","status":"online","status_checked_at":"2025-12-11T02:00:11.302Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["compiler","go","golang","hacktoberfest","javascript"],"created_at":"2024-07-30T20:01:32.391Z","updated_at":"2026-04-02T02:16:57.421Z","avatar_url":"https://github.com/gopherjs.png","language":"Go","readme":"## GopherJS - A compiler from Go to JavaScript\n\n[![GoDoc](https://godoc.org/github.com/gopherjs/gopherjs/js?status.svg)](https://godoc.org/github.com/gopherjs/gopherjs/js)\n[![Sourcegraph](https://sourcegraph.com/github.com/gopherjs/gopherjs/-/badge.svg)](https://sourcegraph.com/github.com/gopherjs/gopherjs?badge)\n[![Github Actions CI](https://github.com/gopherjs/gopherjs/actions/workflows/ci.yaml/badge.svg)](https://github.com/gopherjs/gopherjs/actions/workflows/ci.yaml)\n\nGopherJS compiles Go code ([go.dev](https://go.dev/)) to pure JavaScript code. Its main purpose is to give you the opportunity to write front-end code in Go which will still run in all browsers.\n\n### Help us make GopherJS better!\n\n- ⤴️ **Help us make better decisions by filling a quick 15-question [GopherJS user survey](https://forms.gle/WEjZqZaPxTxjD9YP8)**.\n- 📢 Report and discuss [issues](https://github.com/gopherjs/gopherjs/issues).\n- 🎓 Share your knowledge and experience through [articles](https://github.com/gopherjs/gopherjs/wiki/Community-Tutorials-and-Blogs) and [documentation](https://github.com/gopherjs/gopherjs/tree/master/doc).\n- 🛠️ Write GopherJS [bindings](https://github.com/gopherjs/gopherjs/wiki/Bindings) for other libraries or [contribute](https://github.com/gopherjs/gopherjs/wiki/Developer-Guidelines) to GopherJS itself.\n\n### What's new?\n\n- 2025-08-19: Go 1.19 beta2 is [released](https://github.com/gopherjs/gopherjs/releases/tag/v1.19.0-beta2), with full generics support!\n- 2024-02-24: Go 1.19 support is [available](https://github.com/gopherjs/gopherjs/releases/tag/v1.19.0-beta1)!\n- 2022-08-18: Go 1.18 support is [available](https://github.com/gopherjs/gopherjs/releases/tag/v1.18.0-beta2%2Bgo1.18.5)!\n- 2021-09-19: Go 1.17 support is available!\n- 2021-08-23: Go Modules are now fully supported.\n- 2021-06-19: Complete `syscall/js` package implementation compatible with the upstream Go 1.16.\n- 2021-04-04: **Go 1.16 is now officially supported!** 🎉 🎉 🎉\n\n### Playground\n\nGive GopherJS a try on the [GopherJS Playground](http://gopherjs.github.io/playground/).\n\n### What is supported?\n\nNearly everything, including Goroutines ([compatibility documentation](https://github.com/gopherjs/gopherjs/blob/master/doc/compatibility.md)). Performance is quite good in most cases, see [HTML5 game engine benchmark](https://ajhager.github.io/engi/demos/botmark.html). Cgo is not supported.\n\n### Installation and Usage\n\nGopherJS [requires Go 1.20 or newer](https://github.com/gopherjs/gopherjs/blob/master/doc/compatibility.md#go-version-compatibility). If you need an older Go\nversion, you can use an [older GopherJS release](https://github.com/gopherjs/gopherjs/releases).\n\nInstall GopherJS with `go install`:\n\n```\ngo install github.com/gopherjs/gopherjs@v1.20.1  # Or replace 'v1.20.1' with another version.\n```\n\nIf your local Go distribution as reported by `go version` is newer than Go 1.20, then you need to set the `GOPHERJS_GOROOT` environment variable to a directory that contains a Go 1.20 distribution. For example:\n\n```\ngo install golang.org/dl/go1.20.14@latest\ngo1.20.14 download\nexport GOPHERJS_GOROOT=\"$(go1.20.14 env GOROOT)\"  # Also add this line to your .profile or equivalent.\n```\n\nNow you can use `gopherjs build [package]`, `gopherjs build [files]` or `gopherjs install [package]` which behave similar to the `go` tool. For `main` packages, these commands create a `.js` file and `.js.map` source map in the current directory or in `$GOPATH/bin`. The generated JavaScript file can be used as usual in a website. Use `gopherjs help [command]` to get a list of possible command line flags, e.g. for minification and automatically watching for changes.\n\n`gopherjs` uses your platform's default `GOOS` value when generating code. Supported `GOOS` values are: `linux`, `darwin`. If you're on a different platform (e.g., Windows or FreeBSD), you'll need to set the `GOOS` environment variable to a supported value. For example, `GOOS=linux gopherjs build [package]`.\n\n_Note: GopherJS will try to write compiled object files of the core packages to your $GOROOT/pkg directory. If that fails, it will fall back to $GOPATH/pkg._\n\n#### gopherjs run, gopherjs test\n\nIf you want to use `gopherjs run` or `gopherjs test` to run the generated code locally, install Node.js 18 (or newer).\n\nOn supported `GOOS` platforms, it's possible to make system calls (file system access, etc.) available. See [doc/syscalls.md](https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md) for instructions on how to do so.\n\n#### gopherjs serve\n\n`gopherjs serve` is a useful command you can use during development. It will start an HTTP server serving on \":8080\" by default, then dynamically compile your Go packages with GopherJS and serve them.\n\nFor example, navigating to `http://localhost:8080/example.com/user/project/` should compile and run the Go package `example.com/user/project`. The generated JavaScript output will be served at `http://localhost:8080/example.com/user/project/project.js` (the .js file name will be equal to the base directory name). If the directory contains `index.html` it will be served, otherwise a minimal `index.html` that includes `\u003cscript src=\"project.js\"\u003e\u003c/script\u003e` will be provided, causing the JavaScript to be executed. All other static files will be served too.\n\nRefreshing in the browser will rebuild the served files if needed. Compilation errors will be displayed in terminal, and in browser console. Additionally, it will serve $GOROOT and $GOPATH for sourcemaps.\n\nIf you include an argument, it will be the root from which everything is served. For example, if you run `gopherjs serve github.com/user/project` then the generated JavaScript for the package github.com/user/project/mypkg will be served at http://localhost:8080/mypkg/mypkg.js.\n\n#### Environment Variables\n\nThere are some GopherJS-specific environment variables:\n\n- `GOPHERJS_GOROOT` - if set, GopherJS uses this value as the default GOROOT\n  value, instead of using the system GOROOT as the default GOROOT value\n- `GOPHERJS_SKIP_VERSION_CHECK` - if set to true, GopherJS will not check\n  Go version in the GOROOT for compatibility with the GopherJS release. This\n  is primarily useful for testing GopherJS against unreleased versions of Go.\n\n### Performance Tips\n\n- Use the `-m` command line flag to generate minified code.\n- Apply gzip compression (https://en.wikipedia.org/wiki/HTTP_compression).\n- Use `int` instead of `(u)int8/16/32/64`.\n- Use `float64` instead of `float32`.\n\n### Community\n\n- [#gopherjs Channel on Gophers Slack](https://gophers.slack.com/messages/gopherjs/) (invites to Gophers Slack are available [here](http://blog.gopheracademy.com/gophers-slack-community/#how-can-i-be-invited-to-join:2facdc921b2310f18cb851c36fa92369))\n- [Bindings to JavaScript APIs and libraries](https://github.com/gopherjs/gopherjs/wiki/bindings)\n- [GopherJS Blog](https://medium.com/gopherjs)\n- [GopherJS on Twitter](https://twitter.com/GopherJS)\n- [Examples, tutorials and blogs](https://github.com/gopherjs/gopherjs/wiki/Community-Tutorials-and-Blogs)\n\n### Getting started\n\n#### Interacting with the DOM\n\nThe package `github.com/gopherjs/gopherjs/js` (see [documentation](https://godoc.org/github.com/gopherjs/gopherjs/js)) provides functions for interacting with native JavaScript APIs. For example the line\n\n```js\ndocument.write(\"Hello world!\");\n```\n\nwould look like this in Go:\n\n```go\njs.Global.Get(\"document\").Call(\"write\", \"Hello world!\")\n```\n\nYou may also want use the [DOM bindings](http://dominik.honnef.co/go/js/dom), the [jQuery bindings](https://github.com/gopherjs/jquery) (see [TodoMVC Example](https://github.com/gopherjs/todomvc)) or the [AngularJS bindings](https://github.com/wvell/go-angularjs). Those are some of the [bindings to JavaScript APIs and libraries](https://github.com/gopherjs/gopherjs/wiki/bindings) by community members.\n\n#### Providing library functions for use in other JavaScript code\n\nSet a global variable to a map that contains the functions:\n\n```go\npackage main\n\nimport \"github.com/gopherjs/gopherjs/js\"\n\nfunc main() {\n\tjs.Global.Set(\"pet\", map[string]any{\n\t\t\"New\": New,\n\t})\n}\n\ntype Pet struct {\n\tname string\n}\n\nfunc New(name string) *js.Object {\n\treturn js.MakeWrapper(\u0026Pet{name})\n}\n\nfunc (p *Pet) Name() string {\n\treturn p.name\n}\n\nfunc (p *Pet) SetName(name string) {\n\tp.name = name\n}\n```\n\nFor more details see [Jason Stone's blog post](http://legacytotheedge.blogspot.de/2014/03/gopherjs-go-to-javascript-transpiler.html) about GopherJS.\n\n### Architecture\n\n#### General\n\nGopherJS emulates a 32-bit environment. This means that `int`, `uint` and `uintptr` have a precision of 32 bits. However, the explicit 64-bit integer types `int64` and `uint64` are supported.\n\nThe `GOOS` value of this environment is `js`, and the `GOARCH` value is `ecmascript`. You may use these values in build constraints when [writing platform-specific code](doc/compatibility.md#how-to-write-portable-code). (GopherJS 1.17 and older used `js` as the `GOARCH` value.)\n\n#### Application Lifecycle\n\nThe `main` function is executed as usual after all `init` functions have run. JavaScript callbacks can also invoke Go functions, even after the `main` function has exited. Therefore the end of the `main` function should not be regarded as the end of the application and does not end the execution of other goroutines.\n\nIn the browser, calling `os.Exit` (e.g. indirectly by `log.Fatal`) also does not terminate the execution of the program. For convenience, it calls `runtime.Goexit` to immediately terminate the calling goroutine.\n\n#### Goroutines\n\nGoroutines are fully supported by GopherJS. The only restriction is that you need to start a new goroutine if you want to use blocking code called from external JavaScript:\n\n```go\njs.Global.Get(\"myButton\").Call(\"addEventListener\", \"click\", func() {\n  go func() {\n    [...]\n    someBlockingFunction()\n    [...]\n  }()\n})\n```\n\nHow it works:\n\nJavaScript has no concept of concurrency (except web workers, but those are too strictly separated to be used for goroutines). Because of that, instructions in JavaScript are never blocking. A blocking call would effectively freeze the responsiveness of your web page, so calls with callback arguments are used instead.\n\nGopherJS does some heavy lifting to work around this restriction: Whenever an instruction is blocking (e.g. communicating with a channel that isn't ready), the whole stack will unwind (= all functions return) and the goroutine will be put to sleep. Then another goroutine which is ready to resume gets picked and its stack with all local variables will be restored.\n\n### GopherJS Development\n\nIf you're looking to make changes to the GopherJS compiler, see [Developer Guidelines](https://github.com/gopherjs/gopherjs/wiki/Developer-Guidelines) for additional developer information.\n","funding_links":[],"categories":["Popular","Go","开源类库","Programming","Go Compilers","Go (134)","Open source library","By Target Language","Golang","Go 程序设计","位置信息与地理GEO处理库","Go 编译器","javascript","\u003cspan id=\"go编译器-go-compilers\"\u003eGO编译器 Go Compilers\u003c/span\u003e","CLI Utilities","Go编译器","Best practices","Relational Databases","Repositories"],"sub_categories":["解释器","Golang","Search and Analytic Databases","Phoenix LiveView","Interpreter","JavaScript","Advanced Console UIs","网络服务_其他","SQL 查询语句构建库","检索及分析资料库","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","Database"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgopherjs%2Fgopherjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgopherjs%2Fgopherjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgopherjs%2Fgopherjs/lists"}