{"id":17625167,"url":"https://github.com/neosiae/run-event-handler-once","last_synced_at":"2025-04-07T01:38:45.173Z","repository":{"id":32653676,"uuid":"138432342","full_name":"neosiae/run-event-handler-once","owner":"neosiae","description":"Run an event handler only once","archived":false,"fork":false,"pushed_at":"2022-12-07T20:28:55.000Z","size":156,"stargazers_count":1,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T01:07:24.862Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/neosiae.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}},"created_at":"2018-06-23T20:44:53.000Z","updated_at":"2023-03-10T08:38:49.000Z","dependencies_parsed_at":"2023-01-14T21:50:24.315Z","dependency_job_id":null,"html_url":"https://github.com/neosiae/run-event-handler-once","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosiae%2Frun-event-handler-once","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosiae%2Frun-event-handler-once/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosiae%2Frun-event-handler-once/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neosiae%2Frun-event-handler-once/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neosiae","download_url":"https://codeload.github.com/neosiae/run-event-handler-once/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247578602,"owners_count":20961269,"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":[],"created_at":"2024-10-22T22:08:22.459Z","updated_at":"2025-04-07T01:38:45.151Z","avatar_url":"https://github.com/neosiae.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# run-event-handler-once\n\n![npm](https://img.shields.io/npm/v/run-event-handler-once.svg?style=flat-square) ![Travis (.com) branch](https://img.shields.io/travis/com/neosiae/run-event-handler-once/master.svg?style=flat-square) ![npm](https://img.shields.io/npm/dw/run-event-handler-once.svg?style=flat-square) ![npm bundle size](https://img.shields.io/bundlephobia/min/run-event-handler-once.svg?style=flat-square) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n\nRegister an event handler to a desired target and ensure that the event handler is executed only once.\n\n## Installation\n\nInstall `run-event-handler-once` using npm:\n\n\u003e npm install --save run-event-handler-once\n\nOr via yarn:\n\n\u003e yarn add run-event-handler-once\n\n## Usage\n\n```javascript\nconst runEventHandlerOnce = require('run-event-handler-once')\n\nconst button = document.querySelector('button')\n\nrunEventHandlerOnce(button, 'click', function() {\n  console.log('Hello!')\n})\n```\n\n## API\n\n### runEventHandlerOnce(target, type, listener, [options])\n\n#### target\n\nType: `EventTarget`\n\nRegister an event handler to a desired target.\n\n#### type\n\nType: `string`\n\nThe event type.\n\n#### listener\n\nType: `function`\n\nAn event handler which receives a notification when an event of the specified type occurs.\n\n#### options (Optional)\n\nType: `object`\n\nAn options object that specifies characteristics about the event listener. The available options are:\n\n- **`add`** - An options object that will be passed to `addEventListener`\n- **`remove`** - An options object that will be passed to `removeEventListener`\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneosiae%2Frun-event-handler-once","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneosiae%2Frun-event-handler-once","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneosiae%2Frun-event-handler-once/lists"}