How robertwhurst/keyboardjs works
Project type and purpose
• This is an open-source, browser-compatible JavaScript library (also Node.js-compatible) for setting up keyboard bindings, key combinations, contexts, and managing key events. It is not a full-stack application but rather a client-side toolkit distributed via NPM and UMD.
File structure
• Top-level source lives in lib/:
• lib/keyboard.js – core module that exposes the public API for binding, context, pause/resume, etc.
• lib/key-combo.js – interprets and matches multi-key combos and sequences.
• lib/locale.js – maps key codes to names based on locale.
• Locales: locales/us.js (default US mapping).
• Build & distribution:
• rollup.config.js – bundling into UMD/CJS/ES.
• dist/keyboard.js – compiled distributable.
• Configuration and metadata:
• package.json, bower.json
• .github/, .travis.yml, tests under test/
• Tests reference fixtures for mocking window/document.
README for insights
• Describes core features: binding, key combos, contexts, locale support, preventRepeat, pause/resume, programmatic key press/release, watch/stop.
• No higher-level components beyond keyboard event handling.
Elements
• From Browser Events → Watcher → Combo Engine → Callbacks in App.
• From App → Public API → Context Manager / Binder.
• From Source Modules → Rollup → Dist.
• Blue for runtime modules
• Green for build/distribution
• Orange for external systems (browser, app)