{"id":17597877,"url":"https://github.com/cvan/keyboardevent-key-polyfill","last_synced_at":"2025-08-20T20:31:58.247Z","repository":{"id":33213356,"uuid":"36856235","full_name":"cvan/keyboardevent-key-polyfill","owner":"cvan","description":"polyfill for `KeyboardEvent.prototype.key`","archived":false,"fork":false,"pushed_at":"2018-08-10T15:03:19.000Z","size":18,"stargazers_count":47,"open_issues_count":12,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-17T22:13:01.810Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://cvan.io/keyboardevent-key-polyfill/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cvan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-04T07:52:08.000Z","updated_at":"2022-10-22T17:31:37.000Z","dependencies_parsed_at":"2022-08-07T20:15:51.230Z","dependency_job_id":null,"html_url":"https://github.com/cvan/keyboardevent-key-polyfill","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2Fkeyboardevent-key-polyfill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2Fkeyboardevent-key-polyfill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2Fkeyboardevent-key-polyfill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2Fkeyboardevent-key-polyfill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cvan","download_url":"https://codeload.github.com/cvan/keyboardevent-key-polyfill/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230454427,"owners_count":18228392,"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-22T09:43:57.130Z","updated_at":"2024-12-19T15:07:54.213Z","avatar_url":"https://github.com/cvan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# keyboardevent-key-polyfill\n\nPolyfill for `KeyboardEvent.prototype.key`.\n\n\u003e **NOTE:** All major browsers [now support `KeyboardEvent.prototype.key`](http://caniuse.com/#feat=keyboardevent-key). Firefox already shipped with this for a while; recent versions of Edge, Chrome, and Safari also now have shipped support. This will still enable `KeyboardEvent.prototype.key` in environments where it may not yet be available.\n\n\n## Example\n\n__[View Demo](https://cvan.io/keyboardevent-key-polyfill/)__\n\n\u003chr\u003e\n\nSay goodbye to this:\n\n```js\ndocument.addEventListener('keydown', function (e) {\n  console.log('Code of key pressed:', e.which || e.keyCode);  // 39\n});\n```\n\nAnd hello to this:\n\n```js\ndocument.addEventListener('keydown', function (e) {\n  console.log('Name of key pressed:', e.key);  // ArrowRight\n});\n```\n\n## Usage\n\n### From standalone script\n\nJust drop the script on your page and call the `polyfill` method.\n\n```html\n\u003cscript src=\"index.js\"\u003e\u003c/script\u003e\n\u003cscript\u003ekeyboardeventKeyPolyfill.polyfill();\u003c/script\u003e\n```\n\nIf you're using AMD:\n\n```js\nrequire('keyboardevent-key-polyfill').polyfill();\n```\n\n### From npm (Node/Browserify/WebPack)\n\nInstall from [npm](https://www.npmjs.com/package/keyboardevent-key-polyfill):\n\n```bash\nnpm install keyboardevent-key-polyfill\n```\n\nThen require the CommonJS module for use with [Browserify](http://browserify.org)/[webpack](https://webpack.js.org/):\n\n```js\nrequire('keyboardevent-key-polyfill').polyfill();\n```\n\n\n## License\n\nAll code and content within this source-code repository is licensed under the [**Creative Commons Zero v1.0 Universal** license (CC0 1.0 Universal; Public Domain Dedication)](LICENSE.md).\n\nYou can copy, modify, distribute and perform this work, even for commercial purposes, all without asking permission.\n\nFor more information, refer to these following links:\n\n* a copy of the [license](LICENSE.md) in [this source-code repository](https://github.com/cvan/keyboardevent-key-polyfill)\n* the [human-readable summary](https://creativecommons.org/publicdomain/zero/1.0/) of the [full text of the legal code](https://creativecommons.org/publicdomain/zero/1.0/legalcode)\n* the [full text of the legal code](https://creativecommons.org/publicdomain/zero/1.0/legalcode)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvan%2Fkeyboardevent-key-polyfill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcvan%2Fkeyboardevent-key-polyfill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvan%2Fkeyboardevent-key-polyfill/lists"}