{"id":15105329,"url":"https://github.com/stepicorg/ember-tinykeys","last_synced_at":"2026-02-18T15:01:53.638Z","repository":{"id":44632518,"uuid":"409462217","full_name":"StepicOrg/ember-tinykeys","owner":"StepicOrg","description":"A simple and lightweight keybindings for Ember applications.","archived":false,"fork":false,"pushed_at":"2022-02-03T13:49:21.000Z","size":681,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-06T01:09:41.775Z","etag":null,"topics":["ember-addon","emberjs"],"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/StepicOrg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-23T05:39:19.000Z","updated_at":"2022-02-03T12:15:38.000Z","dependencies_parsed_at":"2022-08-27T08:40:56.840Z","dependency_job_id":null,"html_url":"https://github.com/StepicOrg/ember-tinykeys","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/StepicOrg/ember-tinykeys","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StepicOrg%2Fember-tinykeys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StepicOrg%2Fember-tinykeys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StepicOrg%2Fember-tinykeys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StepicOrg%2Fember-tinykeys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StepicOrg","download_url":"https://codeload.github.com/StepicOrg/ember-tinykeys/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StepicOrg%2Fember-tinykeys/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009401,"owners_count":26084580,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ember-addon","emberjs"],"created_at":"2024-09-25T20:23:30.804Z","updated_at":"2025-10-11T23:41:27.950Z","avatar_url":"https://github.com/StepicOrg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"ember-tinykeys\n==============================================================================\n\n[![npm version](https://badge.fury.io/js/ember-tinykeys.svg)](https://badge.fury.io/js/ember-tinykeys)\n[![CI](https://github.com/StepicOrg/ember-tinykeys/actions/workflows/ci.yml/badge.svg?branch=master\u0026event=push)](https://github.com/StepicOrg/ember-tinykeys/actions/workflows/ci.yml)\n\nA simple, lightweight and Ember Octane-friendly keybindings for Ember applications.\nPowered by [tinykeys](https://github.com/jamiebuilds/tinykeys).\n\n\nCompatibility\n------------------------------------------------------------------------------\n\n* Ember.js v3.25 or above\n* Ember CLI v3.25 or above\n* ember-auto-import v2 or above\n\nDependencies\n-----------------------------------------------------------------------------\n\n* tinykeys ^1.2.0\n* ember-modifier ^2.0.0 || ^3.0.0\n* ember-auto-import ^2.0.0\n\n\nInstallation\n------------------------------------------------------------------------------\n\n```\nember install ember-tinykeys\n```\n\n\nUsage\n------------------------------------------------------------------------------\n\nKeys are matched against\n[`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values)\nand\n[`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)\n(case-insensitive).\n\nKeys can optionally be prefixed with modifiers which match against any valid value to\n[`KeyboardEvent.getModifierState()`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).\n\nThere is also a special `$mod` modifier, which is an alias for `Meta` (⌘) on Mac, and `Control` on Windows/Linux.\n\nKeybindings can also consist of several key presses in a row.\nEach press in the sequence must be pressed within `options.timeout` ms of the last (1000ms by default).\n\nSee [tinykeys README](https://github.com/jamiebuilds/tinykeys#commonly-used-keys-and-codes) for details.\n\n``` javascript\n\"d\" // Matches `event.key`.\n\"KeyD\" // Matches: `event.code`.\n\n\"Control+d\"\n\"Meta+d\"\n\"Shift+D\"\n\"Alt+KeyD\"\n\"Meta+Shift+D\"\n\n\"$mod+D\" // Meta/Control+D\n\"$mod+Shift+D\" // Meta/Control+Shift+D\n\n\"g g\" // vim-like go to top\n\"ArrowUp ArrowUp ArrowDown ArrowDown ArrowLeft ArrowRight ArrowLeft ArrowRight B A\" // fatality\n\"$mod+K $mod+1\"\n```\n\n### Modifier\n\nThere are `on-shortcut-keydown` and `on-shortcut-keyup` modifiers available.\n\n``` handlebars\n{{on-shortcut-keydown \"$mod+Enter\" handler}}\n{{on-shortcut-keydown (array \"Control+Enter\" \"x\") handler}}\n{{on-shortcut-keydown (hash [Control+Enter]=handlerA x=handlerB)}}\n\n{{on-shortcut-keydown \"$mod+Enter\" handler element=customHtmlElement}}\n{{on-shortcut-keydown \"$mod+Enter\" handler element=\".selector\"}}\n{{on-shortcut-keydown \"$mod+Enter\" handler element=\"window\"}}\n```\n\n\n### Functional\n\n``` javascript\nimport { onShortcutKeyDown, onShortcutKeyUp } from 'ember-tinykeys';\nimport { registerDestructor } from '@ember/destroyable';\n\nconst handler = (event) =\u003e { \n  this.doSomeWork();\n  event.stopPropagation();\n  event.preventDefault();\n}\n\nconst unsubscribe = onShortcutKeyDown(element, 'Control+x', handler);\nconst unsubscribe = onShortcutKeyUp(element, 'Control+x', handler);\n\nconst unsubscribe = onShortcutKeyDown(window, 'Control+x', handler);\nconst unsubscribe = onShortcutKeyDown(element, 'Control+x m x y', handler);\nconst unsubscribe = onShortcutKeyDown(element, ['Alt+x', 'Control+x'], handler);\nconst unsubscribe = onShortcutKeyDown(element, { 'Alt+x': handlerA, 'Control+x': handlerB });\n\nregisterDestructor(this, () =\u003e unsubscribe());\n```\n\n\n### Additional utils\n\n- `isEventTargetTextualUserInput`\n\n  You can use this to skip keybindings in textual controls (input, select, textarea, contenteditable).\n\n  ``` javascript\n  import { onShortcutKeyDown, isEventTargetTextualUserInput } from 'ember-tinykeys';\n\n  const handler = (event) =\u003e {\n    if (isEventTargetTextualUserInput(event)) {\n      return;\n    }\n\n    this.doSomeWork();\n    event.stopPropagation();\n    event.preventDefault();\n  }\n  ```\n\n\nContributing\n------------------------------------------------------------------------------\n\nSee the [Contributing](CONTRIBUTING.md) guide for details.\n\n\nLicense\n------------------------------------------------------------------------------\n\nThis project is licensed under the [MIT License](LICENSE.md).\n\n\nAlternatives\n------------------------------------------------------------------------------\n\n- [ember-keyboard](https://github.com/adopted-ember-addons/ember-keyboard)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstepicorg%2Fember-tinykeys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstepicorg%2Fember-tinykeys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstepicorg%2Fember-tinykeys/lists"}