{"id":26502879,"url":"https://github.com/grassator/qml-commonjs","last_synced_at":"2025-03-20T18:36:07.382Z","repository":{"id":12719313,"uuid":"15391985","full_name":"grassator/qml-commonjs","owner":"grassator","description":"Experiment in adding CommonJS support to QML.","archived":false,"fork":false,"pushed_at":"2017-08-26T10:39:47.000Z","size":247,"stargazers_count":28,"open_issues_count":0,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2023-04-09T14:49:39.113Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Ninxes/android_packages_apps_InCallUI","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grassator.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":"2013-12-23T09:28:22.000Z","updated_at":"2020-09-09T08:36:10.000Z","dependencies_parsed_at":"2022-08-29T04:40:17.293Z","dependency_job_id":null,"html_url":"https://github.com/grassator/qml-commonjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fqml-commonjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fqml-commonjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fqml-commonjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grassator%2Fqml-commonjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grassator","download_url":"https://codeload.github.com/grassator/qml-commonjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244672198,"owners_count":20491328,"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":[],"created_at":"2025-03-20T18:36:06.588Z","updated_at":"2025-03-20T18:36:07.376Z","avatar_url":"https://github.com/grassator.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DISCONTINUED\n\n\u003e **Notice:** Unfortunately I can not commit to supporting and further development of this project. Please check [Quickly](https://github.com/quickly/quickly/) which provides similar, or better functionality. If you are still interested in becoming an owner / maintainer please submit an issue and I will get back to you.\n\n# QML CommonJS\n\nExperiment in adding CommonJS module support to QML.\n\n## Changelog\n\n### Version 0.2\n\n* Fixed compatibility with Qt 5.4+ (see changes below for details).\n* **CHANGED** paths for `CommonJS.require` calls from QML are now resolved relative to `QmlEngine::baseUrl()` because evaluating `Qt.resolvedUrl('.')` no longer works from CPP code for some reason.\n* **CHANGED** evaluated module is now wrapped in an [IIFE](https://en.wikipedia.org/wiki/Immediately-invoked_function_expression) to avoid weird problem where function with a name same a property on a global object (e.g. `hasOwnProperty`) would result in an error.\n\n### Version 0.1\n\n* Full [modules](http://nodejs.org/api/modules.html) support\n* `assert` module\n* `setTimeout` / `clearTimeout` / `setInterval` / `clearInterval`\n* experimental support for `util`, `events`, `path`, `url` and `querystring` modules.\n\nWhen accessing top-level functions (like `setTimeout`) from QML, you have to use `CommonJS.` prefix because Qt doesn't allow defining global functions.\n\n## Installation\n\n* Make sure you have [Qt 5.4+](https://www.qt.io/) installed.\n* Clone this repository.\n* Then run `qmake \u0026\u0026 make \u0026\u0026 make install`\n\n## Usage\n\nAfter that you should be able to just import CommonJS as regular QML library and use it in your code:\n\n```js\nimport CommonJS 0.2\nimport QtQuick 2.0\n\nRectangle {\n    Component.onCompleted: {\n        CommonJS.setTimeout(function(){\n        \t// built-in module\n            var example = CommonJS.require('path');\n        \t// relative to QML base url\n            var example = CommonJS.require('./example.js');\n        \t// relative to this file\n            var example = CommonJS.require(Qt.resolvedUrl('./example.js'));\n        });\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrassator%2Fqml-commonjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrassator%2Fqml-commonjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrassator%2Fqml-commonjs/lists"}