{"id":20812196,"url":"https://github.com/BansheeTech/AgnosticRun","last_synced_at":"2025-05-11T20:30:25.879Z","repository":{"id":257806372,"uuid":"866267253","full_name":"BansheeTech/AgnosticRun","owner":"BansheeTech","description":"AgnosticRun is a lightweight utility for ensuring a DOM element exists before executing a function in vanilla JavaScript.","archived":false,"fork":false,"pushed_at":"2024-10-09T23:51:12.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T10:27:48.566Z","etag":null,"topics":["angostic-run","cross-browser","dom-checks","dom-event-handlers","dom-events","dom-manipulation","element-exist","frontend","javascript","js-helpers","js-utilities","lazy-dom-check","safe-dom","vanillajs","web-development"],"latest_commit_sha":null,"homepage":"https://www.banshee.pro","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/BansheeTech.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-02T00:02:26.000Z","updated_at":"2025-04-16T07:11:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"fb4e6612-305b-4474-beb1-f187c21a971c","html_url":"https://github.com/BansheeTech/AgnosticRun","commit_stats":null,"previous_names":["bansheedevelopment/agnosticrun","banshee-technologies/agnosticrun","bansheetech/agnosticrun"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BansheeTech%2FAgnosticRun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BansheeTech%2FAgnosticRun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BansheeTech%2FAgnosticRun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BansheeTech%2FAgnosticRun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BansheeTech","download_url":"https://codeload.github.com/BansheeTech/AgnosticRun/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253631814,"owners_count":21939358,"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":["angostic-run","cross-browser","dom-checks","dom-event-handlers","dom-events","dom-manipulation","element-exist","frontend","javascript","js-helpers","js-utilities","lazy-dom-check","safe-dom","vanillajs","web-development"],"created_at":"2024-11-17T20:51:09.286Z","updated_at":"2025-05-11T20:30:25.737Z","avatar_url":"https://github.com/BansheeTech.png","language":"JavaScript","readme":"\n# AgnosticRun\n\nAgnosticRun is a lightweight utility for ensuring a DOM element exists before executing a function in vanilla JavaScript. It's useful when dealing with dynamic DOM manipulation or when you want to ensure that certain elements are present before applying any JavaScript logic to them.\n\n## Installation\n\nTo install AgnosticRun using npm, run the following command:\n\n```bash\nnpm install agnosticrun\n```\n\n## Usage\n\nTo use AgnosticRun, import the `agnosticRun` function and wrap your own function that interacts with the DOM.\n\n### Example:\n\n```javascript\nimport { agnosticRun } from 'agnosticrun';\n\n// Define your function that will interact with a DOM element\nfunction updateElement(element, text) {\n  element.textContent = text;\n}\n\n// Wrap your function using agnosticRun to ensure the element exists\nconst safeUpdate = agnosticRun(updateElement);\n\n// Call the wrapped function with the element's ID and the desired content\nsafeUpdate('element-id', 'Hello, World!');\n```\n\nIn this example, AgnosticRun ensures that the element with ID `element-id` exists before attempting to update its text content. If the element does not exist, the function will not execute.\n\n## Disable Warns and/or Logs\n\nAgnosticRun allows you to control the appearance of `console.log` and `console.warn` messages through optional flags. You can enable or disable these messages as needed using the following options:\n\n- `debugLog`: Controls the appearance of informational messages (`console.log`). It can be set to `true` or `false`.\n- `debugWarn`: Controls the appearance of warning messages (`console.warn`). It can be set to `true` or `false`.\n\nBy default, both flags are disabled.\n\n### Example usage:\n\nShow only warns on console:\n```javascript\nwindow.agnosticRun = agnosticRun({ debugLog: false, debugWarn: true });\n```\n\nShow only debug messages on console:\n```javascript\nwindow.agnosticRun = agnosticRun({ debugLog: true, debugWarn: false });\n```\n\nDoesn't show any message:\n```javascript\nwindow.agnosticRun = agnosticRun;\n```\n-or-\n```javascript\nwindow.agnosticRun = agnosticRun({ debugLog: false, debugWarn: false });\n```\n\n## License\n\nAgnosticRun is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Issues\n\nIf you encounter any issues, feel free to report them [here](https://github.com/BansheeDevelopment/AgnosticRun/issues).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBansheeTech%2FAgnosticRun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBansheeTech%2FAgnosticRun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBansheeTech%2FAgnosticRun/lists"}