{"id":20459760,"url":"https://github.com/rosbit/go-qjs","last_synced_at":"2025-10-27T06:14:18.503Z","repository":{"id":55872359,"uuid":"523269623","full_name":"rosbit/go-qjs","owner":"rosbit","description":"An embeddable JavaScript engine by interacting with QuickJS. 通过与QuickJS交互实现的嵌入式JavaScript","archived":false,"fork":false,"pushed_at":"2022-08-13T01:33:45.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-16T00:24:46.280Z","etag":null,"topics":["embeddable","expect","golang","javascript","js","quickjs"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rosbit.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}},"created_at":"2022-08-10T08:54:08.000Z","updated_at":"2022-08-10T09:12:35.000Z","dependencies_parsed_at":"2022-08-15T08:10:57.342Z","dependency_job_id":null,"html_url":"https://github.com/rosbit/go-qjs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fgo-qjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fgo-qjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fgo-qjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosbit%2Fgo-qjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rosbit","download_url":"https://codeload.github.com/rosbit/go-qjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242014722,"owners_count":20057880,"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":["embeddable","expect","golang","javascript","js","quickjs"],"created_at":"2024-11-15T12:17:11.737Z","updated_at":"2025-10-27T06:14:18.427Z","avatar_url":"https://github.com/rosbit.png","language":"Go","readme":"# go-qjs, makes QuickJS be embedded easily\n\n[QuickJS](https://bellard.org/quickjs/) is a small and embeddable Javascript engine written by [Fabrice Bellard](https://bellard.org).\n\nThis package is intended to provide a wrapper to interact `QuickJS` with application written in golang.\nWith some helper functions, `go-qjs` makes it simple to calle QuickJS from Golang, and `go-qjs` can be\ntreated as an embeddable JavaScript.\n\n### Install\n\nThe package is fully go-getable, So, just type\n\n  `go get github.com/rosbit/go-qjs`\n\nto install.\n\n### Usage\n\nSuppose there's a Javascript file named `a.js` like this:\n\n```javascript\nfunction add(a, b) {\n    return a+b\n}\n```\n\none can call the Javascript function `add()` in Go code like the following:\n\n```go\npackage main\n\nimport (\n  \"github.com/rosbit/go-qjs\"\n  \"fmt\"\n)\n\nvar add func(int, int)int\n\nfunc main() {\n  ctx, err := qjs.NewQuickJS(\"/path/to/quickjs-exe/qjs\", \"a.js\")\n  if err != nil {\n     fmt.Printf(\"%v\\n\", err)\n     return\n  }\n  defer ctx.Quit()\n\n  // method 1: bind JS function with a golang var\n  if err := ctx.BindFunc(\"add\", \u0026add); err != nil {\n     fmt.Printf(\"%v\\n\", err)\n     return\n  }\n  res := add(1, 2)\n\n  // method 2: call JS function using Call\n  res, err := ctx.CallFunc(\"add\", 1, 2)\n  if err != nil {\n     fmt.Printf(\"%v\\n\", err)\n     return\n  }\n\n  fmt.Println(\"result is:\", res)\n}\n```\n\n### Status\n\nThe package is not fully tested, so be careful.\n\n### Contribution\n\nPull requests are welcome! Also, if you want to discuss something send a pull request with proposal and changes.\n\n__Convention:__ fork the repository and make changes on your fork in a feature branch.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosbit%2Fgo-qjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frosbit%2Fgo-qjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosbit%2Fgo-qjs/lists"}