{"id":21524886,"url":"https://github.com/degjs/domevent","last_synced_at":"2025-03-17T18:17:57.165Z","repository":{"id":5311573,"uuid":"48202033","full_name":"DEGJS/domEvent","owner":"DEGJS","description":"A Promise-based event utility.","archived":false,"fork":false,"pushed_at":"2023-01-04T13:11:46.000Z","size":819,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":12,"default_branch":"main","last_synced_at":"2024-04-14T22:12:27.390Z","etag":null,"topics":["events"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DEGJS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-17T22:39:18.000Z","updated_at":"2021-01-25T21:22:31.000Z","dependencies_parsed_at":"2023-01-13T13:26:04.240Z","dependency_job_id":null,"html_url":"https://github.com/DEGJS/domEvent","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FdomEvent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FdomEvent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FdomEvent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FdomEvent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEGJS","download_url":"https://codeload.github.com/DEGJS/domEvent/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244085010,"owners_count":20395523,"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":["events"],"created_at":"2024-11-24T01:30:21.852Z","updated_at":"2025-03-17T18:17:57.141Z","avatar_url":"https://github.com/DEGJS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DomEvent\n![Run Tests](https://github.com/DEGJS/domEvent/workflows/Run%20Tests/badge.svg)\n\nDomEvent is a Promise-based event utility. Essentially, it wraps a Promise around a DOM event handler and resolves the Promise when the DOM event is triggered. This is especially useful when combined with other Promises to perform some action after all Promises have succeeded.\n\n## Install\nDomEvent is an ES6 module. Consequently, you may need a transpiler ([Babel](https://babeljs.io) is a nice one) to compile DomEvent into compatible Javascript for your runtime environment.\n\nIf you're using NPM, you can install DomEvent with the following command:\n\n```\n$ npm install @degjs/dom-event\n```\n\n## Usage\n``` javascript\nimport domEvent from '@degjs/dom-event';\n\nconst element = document.querySelector('.some-element');\n\n/* Get a Promise for the transitionend event on an element */\nconst transitionPromise = domEvent(element, 'transitionend');\n\n/* Get another Promise for some other asynchronous task, such as an API call */\nconst anotherPromise = someAsyncTask();\n\n/* Perform some action when all promises succeed */\nPromise.all([transitionPromise, anotherPromise])\n\t\t\t.then(onSuccessFunction)\n\t\t\t.catch(onErrorFunction);\n```\n\n## Parameters\n\n#### el\nType: `Element`   \nThe DOM element that the DOM event will occur on.\n\n#### eventName\nType: `String`   \nThe DOM event that will trigger the Promise's success.\n\n## Browser Support\n\nDomEvent depends on the following browser APIs:\n+ [Promise](https://github.com/stefanpenner/es6-promise)\n\nTo support legacy browsers, you'll need to include polyfills for the above APIs.\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegjs%2Fdomevent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdegjs%2Fdomevent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegjs%2Fdomevent/lists"}