{"id":16925056,"url":"https://github.com/hiroppy/keybinding-decorator","last_synced_at":"2026-04-18T09:38:29.377Z","repository":{"id":57289183,"uuid":"100468804","full_name":"hiroppy/keybinding-decorator","owner":"hiroppy","description":"Decorator for keybinding","archived":false,"fork":false,"pushed_at":"2020-08-17T03:23:15.000Z","size":209,"stargazers_count":1,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T01:27:58.569Z","etag":null,"topics":["decorators","keybindings"],"latest_commit_sha":null,"homepage":"","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/hiroppy.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":"2017-08-16T08:51:32.000Z","updated_at":"2019-03-07T17:56:51.000Z","dependencies_parsed_at":"2022-08-29T10:51:04.350Z","dependency_job_id":null,"html_url":"https://github.com/hiroppy/keybinding-decorator","commit_stats":null,"previous_names":["abouthiroppy/keybinding-decorator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hiroppy/keybinding-decorator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiroppy%2Fkeybinding-decorator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiroppy%2Fkeybinding-decorator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiroppy%2Fkeybinding-decorator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiroppy%2Fkeybinding-decorator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hiroppy","download_url":"https://codeload.github.com/hiroppy/keybinding-decorator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiroppy%2Fkeybinding-decorator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31964535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"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":["decorators","keybindings"],"created_at":"2024-10-13T20:08:42.923Z","updated_at":"2026-04-18T09:38:29.361Z","avatar_url":"https://github.com/hiroppy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003ekeybinding-decorator\u003c/h1\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cstrong\u003eDecorator for Keybinding\u003c/strong\u003e\n\u003c/div\u003e\n\n[![Build Status](https://travis-ci.org/abouthiroppy/keybinding-decorator.svg?branch=master)](https://travis-ci.org/abouthiroppy/keybinding-decorator)\n[![npm version](https://badge.fury.io/js/keybinding-decorator.svg)](https://badge.fury.io/js/keybinding-decorator)\n\nkeybinding-decorator is using [Mousetrap](https://github.com/ccampbell/mousetrap).\n\nDecorators offer a convenient declarative syntax to modify the shape of class declarations.  \nsee: https://tc39.github.io/proposal-decorators/\n\nYou must use `babel-plugin-transform-decorators-legacy`.\n\n## Install\n\n```\n$ npm install keybinding-decorator --save\n```\n\n## Usage\n\n```javascript\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport keybind from 'keybinding-decorator';\n\nclass Main extends React.Component {\n  constructor() {\n    super();\n\n    this.state = { current: '' };\n\n    // init\n    Reflect.apply(this.csk, this, []);\n    Reflect.apply(this.esc, this, []);\n  }\n\n  @keybind('command+shift+k')\n  csk() {\n    this.setState({ current: 'command+shift+k' });\n  }\n\n  @keybind('esc')\n  esc() {\n    this.setState({ current: 'esc' });\n  }\n\n  componentWillUnmount() {\n    this.esc.unbind();\n    this.csk.unbind();\n  }\n\n  render() {\n    return \u003cdiv\u003ecurrent: {this.state.current}\u003c/div\u003e;\n  }\n}\n\nconst root = () =\u003e \u003cMain /\u003e;\n\nReactDOM.render(root(), document.getElementById('root'));\n```\n\n## Method\n\n### unbind()\n\nA method binded by `decorator` has `unbind` method.  \nRelease this function from Mousetrap.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiroppy%2Fkeybinding-decorator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiroppy%2Fkeybinding-decorator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiroppy%2Fkeybinding-decorator/lists"}