{"id":18823026,"url":"https://github.com/himynameisdave/browser-event-utils","last_synced_at":"2025-04-14T01:24:33.604Z","repository":{"id":38274550,"uuid":"173382102","full_name":"himynameisdave/browser-event-utils","owner":"himynameisdave","description":"🎟 A collection of higher-order functions for invoking common browser event methods.","archived":false,"fork":false,"pushed_at":"2023-01-06T01:41:10.000Z","size":2744,"stargazers_count":4,"open_issues_count":24,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T03:51:21.462Z","etag":null,"topics":["browser-events","event-handling","event-target","higher-order-functions","keyboard","keypress","preventdefault","stoppropagation","utilities"],"latest_commit_sha":null,"homepage":"https://himynameisdave.github.io/browser-event-utils","language":"TypeScript","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/himynameisdave.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-01T23:39:21.000Z","updated_at":"2024-06-24T02:39:59.000Z","dependencies_parsed_at":"2023-02-05T01:45:54.167Z","dependency_job_id":null,"html_url":"https://github.com/himynameisdave/browser-event-utils","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himynameisdave%2Fbrowser-event-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himynameisdave%2Fbrowser-event-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himynameisdave%2Fbrowser-event-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himynameisdave%2Fbrowser-event-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/himynameisdave","download_url":"https://codeload.github.com/himynameisdave/browser-event-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248805730,"owners_count":21164378,"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":["browser-events","event-handling","event-target","higher-order-functions","keyboard","keypress","preventdefault","stoppropagation","utilities"],"created_at":"2024-11-08T00:52:25.735Z","updated_at":"2025-04-14T01:24:33.565Z","avatar_url":"https://github.com/himynameisdave.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\" margin=\"0 auto 20px\"\u003e\n  \u003ch1\u003ebrowser-event-utils\u003c/h1\u003e\n  \u003cp style=\"font-style: italic;\"\u003e🎟 A collection of higher-order functions for invoking common browser event methods.\u003c/p\u003e\n  \u003cdiv\u003e\n    \u003ca href='https://travis-ci.org/himynameisdave/browser-event-utils'\u003e\n      \u003cimg src=\"https://api.travis-ci.org/himynameisdave/browser-event-utils.svg?branch=master\" alt=\"Travis Badge\" /\u003e\n    \u003c/a\u003e\n    \u003ca href='https://coveralls.io/github/himynameisdave/browser-event-utils?branch=master'\u003e\n      \u003cimg src='https://coveralls.io/repos/github/himynameisdave/browser-event-utils/badge.svg?branch=master' alt='Coverage Status' /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://bundlephobia.com/result?p=browser-event-utils\"\u003e\n      \u003cimg src=\"https://img.shields.io/bundlephobia/min/browser-event-utils.svg\" alt=\"Bundle size (minified)\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/browser-event-utils\"\u003e\n      \u003cimg src=\"https://img.shields.io/npm/dm/browser-event-utils.svg\" alt=\"Downloads\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://app.fossa.io/projects/git%2Bgithub.com%2Fhimynameisdave%2Fbrowser-event-utils?ref=badge_shield\" alt=\"FOSSA Status\"\u003e\n      \u003cimg src=\"https://app.fossa.io/api/projects/git%2Bgithub.com%2Fhimynameisdave%2Fbrowser-event-utils.svg?type=shield\"/\u003e\n    \u003c/a\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n\n---\n\n### Motivation\n\nHow often do you call stuff like `event.preventDefault` or `event.stopPropagation` when handling events in client-side JavaScript? I bet it's pretty often.\n\nThis ([~1kb](https://bundlephobia.com/result?p=browser-event-utils)) package aims to provide you with a set of [higher-order functions](https://eloquentjavascript.net/05_higher_order.html) which handle these things for you.\n\nCould you survive without this library? Absolutely. But I've found that in larger codebases, it can become cumbersome to always sprinkle `e.preventDefault()` calls all over the place. It adds complexity to your event handlers, which violates the [**Do One Thing (DOT)**](https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well) principal, plus it _(in theory)_ could make your unit tests more complicated (if you care about asserting that event methods are called).\n\nThis library can also help aleviate some of the pains surrounding [event pooling](https://reactjs.org/docs/events.html#event-pooling) in React.\n\n### Installation\n\nThis package is available on NPM, and you can install it with `npm` or `yarn`:\n\n```\nnpm install browser-event-utils\n\nyarn add browser-event-utils\n```\n\n**Browser/UMD**\n\nIf you want to just import this library directly in the browser, you can add the following script tag:\n\n```html\n\u003cscript src=\"https://unpkg.com/browser-event-utils/bin/index.umd.js\" /\u003e\n```\n\nThis will expose a `browserEventUtils` global, on which you will find all of the utility methods.\n\n### Documentation\n\nPlease view the [documentation](https://himynameisdave.github.io/browser-event-utils) for guides to explore what methods this package exposes and how to use them.\n\n### Contributing\n\nPlease read the [contributing guidelines](https://github.com/himynameisdave/browser-event-utils/blob/master/.github/CONTRIBUTING.md) for more info.\n\n### Migration\n\nFor information on migrating between major versions of this package, please review the [migration guide](https://github.com/himynameisdave/browser-event-utils/blob/master/.github/MIGRATION_GUIDE.md).\n\n---\n\n_✌️ Built by [Dave Lunny](http://himynameisdave.com)._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhimynameisdave%2Fbrowser-event-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhimynameisdave%2Fbrowser-event-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhimynameisdave%2Fbrowser-event-utils/lists"}