{"id":16473147,"url":"https://github.com/binki/binki-userscript-when-element-query-selector-async","last_synced_at":"2025-09-17T16:20:36.319Z","repository":{"id":231959797,"uuid":"783127824","full_name":"binki/binki-userscript-when-element-query-selector-async","owner":"binki","description":"A convenience to wait for querySelector() to match something based on mutation events","archived":false,"fork":false,"pushed_at":"2024-04-07T02:36:39.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T12:43:07.686Z","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":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/binki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2024-04-07T02:34:50.000Z","updated_at":"2024-04-07T02:35:15.000Z","dependencies_parsed_at":"2024-04-07T03:35:25.453Z","dependency_job_id":"31d78f9e-9803-442f-ab59-5c3d79eb81b0","html_url":"https://github.com/binki/binki-userscript-when-element-query-selector-async","commit_stats":null,"previous_names":["binki/binki-userscript-when-element-query-selector-async"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/binki/binki-userscript-when-element-query-selector-async","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binki%2Fbinki-userscript-when-element-query-selector-async","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binki%2Fbinki-userscript-when-element-query-selector-async/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binki%2Fbinki-userscript-when-element-query-selector-async/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binki%2Fbinki-userscript-when-element-query-selector-async/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binki","download_url":"https://codeload.github.com/binki/binki-userscript-when-element-query-selector-async/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binki%2Fbinki-userscript-when-element-query-selector-async/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275623409,"owners_count":25498335,"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-09-17T02:00:09.119Z","response_time":84,"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":[],"created_at":"2024-10-11T12:25:31.274Z","updated_at":"2025-09-17T16:20:36.301Z","avatar_url":"https://github.com/binki.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"A convenience to call `querySelector()` until a non-`null` value is returned using mutation events.\n\n# Usage\n\nInclude this in your userscript using [`@require`](https://wiki.greasespot.net/Metadata_Block#.40require). It is recommended to [use a permalink](https://docs.github.com/repositories/working-with-files/using-files/getting-permanent-links-to-files) instead of referring to `master`.\n\n```js\n// ==UserScript==\n// @name example\n// @version 1.0\n// @require https://github.com/binki/binki-userscript-when-element-query-selector-async/raw/master/binki-userscript-when-element-query-selector-async.js\n// ==UserScript==\n\n(async () =\u003e {\n  const button = await whenElementQuerySelectorAsync(document.body, 'a.btn-primary');\n  button.click();\n})();\n```\n\n# API\n\n```js\nwhenElementQuerySelectorAsync(element, selectors, signal);\n```\n\nParameters:\n\n* `element` is the [`Element`](https://dom.spec.whatwg.org/#interface-element) whose [`querySelector`](https://dom.spec.whatwg.org/#dom-parentnode-queryselector) function is called and which is monitored for mutation events.\n* `selectors` is a string of CSS selectors to query. Note that, since this is powered by mutation events, it is inappropriate to use pseudo classes such as `:focus` which can change without the document being mutated. \n* `signal` (optional) an [`AbortSignal`](https://dom.spec.whatwg.org/#abortsignal). If supplied, this can be used to cancel the wait. Otherwise, the wait will continue until the query matches.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinki%2Fbinki-userscript-when-element-query-selector-async","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinki%2Fbinki-userscript-when-element-query-selector-async","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinki%2Fbinki-userscript-when-element-query-selector-async/lists"}