{"id":16847491,"url":"https://github.com/fabiosantoscode/keys-down","last_synced_at":"2025-03-18T07:17:18.990Z","repository":{"id":33014164,"uuid":"149801729","full_name":"fabiosantoscode/keys-down","owner":"fabiosantoscode","description":"Check what keys are down with a simple API","archived":false,"fork":false,"pushed_at":"2022-12-02T12:12:07.000Z","size":259,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T07:39:48.117Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/fabiosantoscode.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-09-21T18:21:17.000Z","updated_at":"2020-02-14T23:02:23.000Z","dependencies_parsed_at":"2023-01-14T23:03:18.272Z","dependency_job_id":null,"html_url":"https://github.com/fabiosantoscode/keys-down","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"23d474845d1b28719c0f89ea7db54a3d04f14bda"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiosantoscode%2Fkeys-down","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiosantoscode%2Fkeys-down/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiosantoscode%2Fkeys-down/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiosantoscode%2Fkeys-down/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiosantoscode","download_url":"https://codeload.github.com/fabiosantoscode/keys-down/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244173553,"owners_count":20410300,"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-13T13:08:08.720Z","updated_at":"2025-03-18T07:17:18.969Z","avatar_url":"https://github.com/fabiosantoscode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-keys-down\n\nCheck what keys are down with a simple API\n\n## installation\n\n```bash\nnpm install node-keys-down\n```\n\n## require('node-keys-down').start()\n\nStart detecting keyboard activity. Call this method before the others.\n\nIt returns a function that ends detecting keyboard activity.\n\n```javascript\nconst keysDown = require('node-keys-down')\nconst end = keysDown.start()\n\n// ... your code\n\nend()\n```\n\n## require('node-keys-down').isPressed(key)\n\nReturns `true` if `key` is pressed. The key code looks like [what you might see in `event.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values).\n\n```javascript\nconst keysDown = require('node-keys-down')\nkeysDown.start()\n\n// ...\n\nconst playerMovingLeft = keysDown.isPressed('ArrowLeft')\nconst playerRunning = keysDown.isPressed('Shift')\nconst playerShooting = keysDown.isPressed(' ')\nconst playerUsing = keyDown.isPressed('e') || keysDown.isPressed('E')\n```\n\n## require('node-keys-down').keysPressed()\n\nReturns an array with the names of all keys which are currently pressed.\n\n\n```javascript\nconst keysDown = require('node-keys-down')\nkeysDown.start()\n\n// ...\n\nconsole.log(keysDown.keysPressed())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiosantoscode%2Fkeys-down","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiosantoscode%2Fkeys-down","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiosantoscode%2Fkeys-down/lists"}