{"id":20572914,"url":"https://github.com/zlgopen/awtk-iotjs","last_synced_at":"2026-03-02T05:05:29.189Z","repository":{"id":49098753,"uuid":"190486239","full_name":"zlgopen/awtk-iotjs","owner":"zlgopen","description":"run awtk with iotjs","archived":false,"fork":false,"pushed_at":"2021-06-30T03:36:05.000Z","size":3839,"stargazers_count":31,"open_issues_count":5,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-14T17:31:49.161Z","etag":null,"topics":["awtk","gui","iotjs","jerryscript"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zlgopen.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":"2019-06-06T00:13:25.000Z","updated_at":"2023-07-03T07:56:29.000Z","dependencies_parsed_at":"2022-08-25T22:41:58.210Z","dependency_job_id":null,"html_url":"https://github.com/zlgopen/awtk-iotjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zlgopen/awtk-iotjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zlgopen%2Fawtk-iotjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zlgopen%2Fawtk-iotjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zlgopen%2Fawtk-iotjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zlgopen%2Fawtk-iotjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zlgopen","download_url":"https://codeload.github.com/zlgopen/awtk-iotjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zlgopen%2Fawtk-iotjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29993142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"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":["awtk","gui","iotjs","jerryscript"],"created_at":"2024-11-16T05:24:32.925Z","updated_at":"2026-03-02T05:05:29.155Z","avatar_url":"https://github.com/zlgopen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# awtk-iotjs\n\n## 一、介绍\n\n* 1. 关于 [iotjs](http://iotjs.net/)\n\n\u003e [iotjs](https://github.com/pando-project/iotjs) 是三星开源的 javascript 物联网开发平台。它为 javascript 应用程序提供了访问硬件、网络、文件系统和异步化的能力，功能类似于 nodejs，但无论是代码体积还是内存需求，iotjs 都要小很多，是用 javascript 开发 iot 设备应用程序的首选。\n\n* 2. 关于 [AWTK](https://github.com/zlgopen/awtk)\n\n\u003eAWTK 全称 Toolkit AnyWhere，是 ZLG 开发的开源 GUI 引擎，旨在为嵌入式系统、WEB、各种小程序、手机和 PC 打造的通用 GUI 引擎，为用户提供一个功能强大、高效可靠、简单易用、可轻松做出炫酷效果的 GUI 引擎。\n\n[awtk-iotjs](https://github.com/zlgopen/awtk-iotjs) 将 [awtk](https://github.com/zlgopen/awtk) 和 [iotjs](http://iotjs.net/) 有机结合起来，用 javascript 打通 GUI、网络和硬件，完全采用 javascript 开发物联网应用程序。\n\n## 二、编译\n\n\u003e 如果下载太慢，可以把 github.com 换成 hub.fastgit.org\n\n* 下载编译 iotjs\n\n```\ngit clone https://github.com/pando-project/iotjs.git\ncd iotjs\n./tools/build.py\ncd -\n```\n\n* 下载编译 awtk\n\n```\ngit clone https://github.com/zlgopen/awtk.git\ncd awtk\nscons\ncd -\n```\n\n* 下载编译 awtk-jerryscript\n\n```\ngit clone https://github.com/zlgopen/awtk-jerryscript.git\ncd awtk-jerryscript\ngit clone https://github.com/jerryscript-project/jerryscript.git 3rd/jerryscript\ncd 3rd/jerryscript/jerryscript \u0026\u0026 git checkout 8ba0d1b6ee5a065a42f3b306771ad8e3c0d819bc \u0026\u0026 cd -\nscons IOTJS=true\ncd -\n```\n\n* 下载编译 awtk-iotjs\n\n准备工作：\n\u003e 目前我不知道如何在 module.json 中指定编译参数，所以只好修改 iotjs/CMakeLists.txt 了。请在倒数第二行增加下面这行代码。\n\n```\ninclude(../awtk-iotjs/awtk-module/awtk.cmake)\n```\n\n下载编译：\n\n```\ngit clone https://github.com/zlgopen/awtk-iotjs.git\ncd awtk-iotjs\n./build.sh\n```\n\n\u003e 请确认以上项目均在同一个目录。\n\n## 三、运行 DEMO\n\n* 生成示例代码的资源\n\n```\npython scripts/update_res.py all \n```\n\n* 运行 demo\n\n```\n./run.sh demos/buttons.js\n```\n\n## 四、开发\n\n在开发时可以使用：\n\n* iotjs 提供的模块。\n* awtk-jerryscript 提供的 GUI 控件。\n* 其它第三方模块。\n\n与 awtk-jerryscript 主要差异是需要加载并初始化 awtk：\n\n```\nrequire('awtk').init(320, 480);\n```\n\n完整示例：\n\n```c\nrequire('awtk').init(320, 480);\n\nfunction applicationInit() {\n  var win = TWindow.create(null, 0, 0, 0, 0); \n  var ok = TButton.create(win, 0, 0, 0, 0); \n\n  ok.setText(\"ok\");\n  ok.setSelfLayoutParams(\"center\", \"middle\", \"50%\", \"30\");\n\n  ok.on(TEventType.CLICK, function(evt) {\n    var e = TPointerEvent.cast(evt);\n    console.log(\"on click: \" + e.x + \" \" + e.y);\n\n    return TRet.OK;\n  }); \n\n  win.layout();\n}\n\napplicationInit()\n```\n\n## 五、已知问题\n\n* 只支持 Linux 系统 (Ubuntu \u003e= 16)。\n* 未 awtk-linux-fb 上验证，可能修改一下脚本。\n\n\u003e 理论上 Windows 平台也是可以的，但是 iotjs 没编译过。\n\n## 六、内部实现文档\n\n* [为 iotjs 开发原生模块](docs/write_iotjs_native_module.md)\n\n* [集成 GUI 到 iotjs](docs/integrate_gui_with_iot.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzlgopen%2Fawtk-iotjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzlgopen%2Fawtk-iotjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzlgopen%2Fawtk-iotjs/lists"}