{"id":25029096,"url":"https://github.com/lsphillips/wait-for-the-element","last_synced_at":"2025-04-13T16:09:56.221Z","repository":{"id":47831918,"uuid":"150179162","full_name":"lsphillips/wait-for-the-element","owner":"lsphillips","description":"A utility library that enables you to efficiently wait for an element to appear or disappear.","archived":false,"fork":false,"pushed_at":"2025-04-11T17:52:13.000Z","size":1617,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T16:09:50.783Z","etag":null,"topics":["library"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/wait-for-the-element","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/lsphillips.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-09-24T23:03:13.000Z","updated_at":"2025-04-11T17:52:17.000Z","dependencies_parsed_at":"2024-01-01T19:24:20.170Z","dependency_job_id":"732b636a-daf8-4003-a6b2-cca75ea5316b","html_url":"https://github.com/lsphillips/wait-for-the-element","commit_stats":{"total_commits":98,"total_committers":2,"mean_commits":49.0,"dds":0.4897959183673469,"last_synced_commit":"8badd1e2d3212f0e743adfc78f20a61ba0b576b2"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsphillips%2Fwait-for-the-element","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsphillips%2Fwait-for-the-element/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsphillips%2Fwait-for-the-element/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsphillips%2Fwait-for-the-element/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsphillips","download_url":"https://codeload.github.com/lsphillips/wait-for-the-element/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741203,"owners_count":21154255,"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":["library"],"created_at":"2025-02-05T20:58:54.245Z","updated_at":"2025-04-13T16:09:56.216Z","avatar_url":"https://github.com/lsphillips.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `wait-for-the-element`\n\n[![Available from NPM](https://img.shields.io/npm/v/wait-for-the-element.svg?maxAge=900)](https://www.npmjs.com/package/wait-for-the-element)\n[![Built using GitHub Action](https://github.com/lsphillips/wait-for-the-element/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/lsphillips/wait-for-the-element/actions)\n\nA utility library that enables you to efficiently wait for an element to appear or disappear.\n\n## Usage\n\nThis module can be treated as an ES module:\n\n``` js\nimport { waitForTheElement, waitForTheElementToDisappear } from 'wait-for-the-element';\n```\n\nThis module can also be treated as a CommonJS module:\n\n``` js\nconst { waitForTheElement, waitForTheElementToDisappear } = require('wait-for-the-element');\n```\n\n### Waiting for an element\n\nYou can wait for an element to match a provided selector and retrieve it:\n\n``` js\nconst element = await waitForTheElement('.target', {\n  timeout : 5000\n});\n\nif (element === null)\n{\n  // After 5 seconds, a matching element still doesn't exist.\n}\n```\n\n**Important Note:** If the selector matches multiple elements, only the first match will be returned.\n\n### Waiting for an element to disappear\n\nYou can wait for all elements to stop matching a provided selector:\n\n``` js\nconst hidden = await waitForTheElementToDisappear('.target', {\n  timeout : 5000\n});\n\nif (!hidden)\n{\n  // After 5 seconds, a matching element still exists.\n}\n```\n\n### Selectors\n\nAll functions accept CSS selectors supported by `document.querySelector()`.\n\n### Options\n\nAll functions accept an optional settings object that control how elements are searched for:\n\n| Options   | Required | Default    | Description                                           |\n| --------- | :------: | :--------: | ----------------------------------------------------- |\n| `timeout` | No       | `2500`     | The maximum amount of time (in milliseconds) to wait. |\n| `scope`   | No       | `document` | The root element to start searching from.             |\n\n## Getting started\n\nThis module is available through the Node Package Manager (NPM):\n\n```\nnpm install wait-for-the-element\n```\n\n## Development\n\n### Building\n\nYou can build UMD and ESM versions of this module that are both ES5 compatible and minified:\n\n``` sh\nnpm run build\n```\n\n### Testing\n\nThis module also has a robust test suite:\n\n``` sh\nnpm test\n```\n\nThis includes a code quality check using ESLint. Please refer to the `eslint.config.js` files to familiar yourself with the rules.\n\n## License\n\nThis project is released under the [MIT license](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsphillips%2Fwait-for-the-element","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsphillips%2Fwait-for-the-element","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsphillips%2Fwait-for-the-element/lists"}