{"id":16473119,"url":"https://github.com/binki/binki-userscript-when-element-changed-async","last_synced_at":"2025-08-06T08:04:58.665Z","repository":{"id":143134194,"uuid":"469276770","full_name":"binki/binki-userscript-when-element-changed-async","owner":"binki","description":"A whenElementChangedAsync() function for use in userscripts (Greasemonkey).","archived":false,"fork":false,"pushed_at":"2022-03-13T05:15:58.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T12:40:36.387Z","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,"publiccode":null,"codemeta":null}},"created_at":"2022-03-13T05:14:22.000Z","updated_at":"2022-03-13T05:14:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"a8e701be-646c-4c9e-bd11-b793ff165a2e","html_url":"https://github.com/binki/binki-userscript-when-element-changed-async","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/binki/binki-userscript-when-element-changed-async","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binki%2Fbinki-userscript-when-element-changed-async","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binki%2Fbinki-userscript-when-element-changed-async/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binki%2Fbinki-userscript-when-element-changed-async/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binki%2Fbinki-userscript-when-element-changed-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-changed-async/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binki%2Fbinki-userscript-when-element-changed-async/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269042263,"owners_count":24349655,"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-08-06T02:00:09.910Z","response_time":99,"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:23.531Z","updated_at":"2025-08-06T08:04:58.625Z","avatar_url":"https://github.com/binki.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 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/en/repositories/working-with-files/using-files/getting-permanent-links-to-files) instead of referring to `master`.\n```js\n// ==UserScript==\n// @name example\n// @version 1.0\n// @require https://github.com/binki/binki-userscript-when-element-changed-async/raw/master/binki-userscript-when-element-changed-async.js\n// ==UserScript==\n\n(async () =\u003e {\n  const soughtElement = await (async () =\u003e {\n    while (true) {\n      const e = document.querySelector('*[role=textbox][spellcheck=true][contenteditable=true].notranslate');\n      if (e) return e;\n      await whenElementChangedAsync(document.body);\n    }\n  })();\n  console.log(`Found element`, soughtElement);\n})();\n```\n\n## API\n\n```js\nwhenElementChangedAsync(target, options);\n```\n\nParameters:\n\n* `target` is the `Element` passed directly to [`MutationObserver.observe()`](https://dom.spec.whatwg.org/#dom-mutationobserver-observe). It must be specified and represents the element to monitor for changes.\n* `options` is the [`MutationObserverInit`](https://dom.spec.whatwg.org/#dictdef-mutationobserverinit) passed directly to [`MutationObserver.observe()`](https://dom.spec.whatwg.org/#dom-mutationobserver-observe). If unspecified, a default which specifies `childList`, `attributes`, `characterData` shall be used. However, this is nonperformant and should be avoided when possible.\n\nReturns:\n\nA `Promise` which resolves to an array of [`MutationRecord`](https://dom.spec.whatwg.org/#mutationrecord) once a mutation happens.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinki%2Fbinki-userscript-when-element-changed-async","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinki%2Fbinki-userscript-when-element-changed-async","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinki%2Fbinki-userscript-when-element-changed-async/lists"}