{"_id":"@beaker/electron-localshortcut","_rev":"1-de22295342e9bc28ab6d7677efb6cca6","name":"@beaker/electron-localshortcut","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@beaker/electron-localshortcut","version":"1.0.0","description":"register/unregister a keyboard shortcut locally to a BrowserWindow instance, without using a Menu","repository":{"type":"git","url":"git+https://github.com/parro-it/electron-localshortcut.git"},"license":"MIT","author":{"name":"andrea@parro.it"},"scripts":{"lint":"eslint . --ignore-pattern 'node_modules/*' --fix","start":"electron example.js","test":"electron test.js | faucet && xo","tape":"DEBUG=electron-localshortcut electron test.js"},"keywords":["electron","shortcuts","browser-window"],"dependencies":{"electron-is-accelerator":"^0.1.0","keyboardevent-from-electron-accelerator":"^1.1.0","keyboardevents-areequal":"^0.2.1"},"devDependencies":{"eslint":"^4.19.1"},"gitHead":"8a61ee43f587d38fae2415a0997ecf2c58f1fc29","bugs":{"url":"https://github.com/parro-it/electron-localshortcut/issues"},"homepage":"https://github.com/parro-it/electron-localshortcut#readme","_id":"@beaker/electron-localshortcut@1.0.0","_npmVersion":"6.1.0","_nodeVersion":"10.6.0","_npmUser":{"name":"pfrazee","email":"pfrazee@gmail.com"},"dist":{"integrity":"sha512-XJRlN2w0A699QI5wQMkyUIpcTT1w+w4ue6RYzb8pvOMq18ciTNKT9impFPJfLrDvF4hekh74rXOlIwvHG2mGGw==","shasum":"edf307f20c842caeaff139c6648bb7e1d46ee767","tarball":"https://registry.npmjs.org/@beaker/electron-localshortcut/-/electron-localshortcut-1.0.0.tgz","fileCount":4,"unpackedSize":10750,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbxpEwCRA9TVsSAnZWagAAHc0P/0zREOW3aOx+pjgPoJnq\ntsMp6X/u3iKiMDUmHMNU8VUTsjsKZYy/ylIIMe9lZ160njr7GeIB6YpgPzpj\nku9F8ugb3s5+4UPjh0qbNLtz/7ZUfBpmy0WoHwbUA6dlTlN/MNp7X1XqJl99\nTiaU7qkDcvnAD+GbQUvDAgydb0KgYWJSCH4wwnp5OP9CYGmULYU3E8ynHb15\nBsMNRJPB0m/V4BUiQ+GpiOjOOco6hr+NcbBW1ePURZEZIz7g32xcDvEmBx9K\n7ovETmiKE77nhHB6PpgdrKYvzvTw46J20a0wSYFRB/piymIyDTUCDYtpwgNT\n8u0r2l9kweMYulsuHfpsnJ5fVDnPslKn+q0nY4McxuVK2B9cYw8I2q+lFMat\njmXCQx9IkTz1AwoVtOl4PdjGUlHnUNdsh78h95fI49Xa/vy9cB3aVeB2ZZZp\nsHW3+F+1+0cPXx2YobMYoMU/hA3+cLal7LbYwPARPyfxCw6IkOdDqa4XyEpR\noEIXsVVC+lpXR/W4rRNRLf1/3x5cdq07ZHWXsK2H109/Nw68XAG3oEjRJiZO\nhuaIdQLhkdFsAXsOuRKu91Va4ot6v6OboTZVbeXegJGGQ1Nc3O3bJyhmPXum\nMcgSziMAU8SNGu5T3BisSY0QyusM+ZAao6Ilf5ygfXs58fIIVEA69ccXWHGH\nYw50\r\n=LShT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBFVNuRFfn1oL236GPhbc8sV5hH+4qFs/knf8DUd/pSJAiB+OATuTwSPxvqMZSdsdopOU8CwjN9M2vOggEGmDJda9Q=="}]},"maintainers":[{"name":"pfraze","email":"pfrazee@gmail.com"},{"name":"pfrazee","email":"pfrazee@gmail.com"},{"name":"taravancil","email":"tbvanc@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electron-localshortcut_1.0.0_1539739951328_0.3812996105103599"},"_hasShrinkwrap":false}},"time":{"created":"2018-10-17T01:32:31.248Z","1.0.0":"2018-10-17T01:32:31.472Z","modified":"2022-04-04T18:05:09.169Z"},"maintainers":[{"name":"pfraze","email":"pfrazee@gmail.com"},{"name":"pfrazee","email":"pfrazee@gmail.com"},{"name":"taravancil","email":"tbvanc@gmail.com"}],"description":"register/unregister a keyboard shortcut locally to a BrowserWindow instance, without using a Menu","homepage":"https://github.com/parro-it/electron-localshortcut#readme","keywords":["electron","shortcuts","browser-window"],"repository":{"type":"git","url":"git+https://github.com/parro-it/electron-localshortcut.git"},"author":{"name":"andrea@parro.it"},"bugs":{"url":"https://github.com/parro-it/electron-localshortcut/issues"},"license":"MIT","readme":"# electron-localshortcut\n\nA module to register/unregister a keyboard shortcut\nlocally to a BrowserWindow instance, without using a Menu.\n\nThis is built to circumvent [this Electron issue](https://github.com/atom/electron/issues/1334).\n\n**Forked from [parro-it/electron-localshortcut](https://github.com/parro-it/electron-localshortcut) to add support for windows' child webviews.**\n\n[![Travis Build Status](https://img.shields.io/travis/parro-it/electron-localshortcut/master.svg)](http://travis-ci.org/parro-it/electron-localshortcut)\n[![NPM module](https://img.shields.io/npm/v/electron-localshortcut.svg)](https://npmjs.org/package/electron-localshortcut)\n[![NPM downloads](https://img.shields.io/npm/dt/electron-localshortcut.svg)](https://npmjs.org/package/electron-localshortcut)\n[![Greenkeeper badge](https://badges.greenkeeper.io/parro-it/electron-localshortcut.svg)](https://greenkeeper.io/)\n\n# Installation\n\n```bash\nnpm install --save electron-localshortcut\n```\n\n# Usage\n\n```javascript\n\tconst electronLocalshortcut = require('electron-localshortcut');\n\tconst BrowserWindow = require('electron').BrowserWindow;\n\n\tconst win = new BrowserWindow();\n\twin.loadUrl('https://github.com');\n\twin.show();\n\n\telectronLocalshortcut.register(win, 'Ctrl+A', () => {\n\t\tconsole.log('You pressed ctrl & A');\n\t});\n\n\telectronLocalshortcut.register(win, 'Ctrl+B', () => {\n\t\tconsole.log('You pressed ctrl & B');\n\t});\n\n\telectronLocalshortcut.register(win, ['Ctrl+R', 'F5'], () => {\n        console.log('You pressed ctrl & R or F5');\n    });\n\n\telectronLocalshortcut.unregister(win, 'Ctrl+A');\n\telectronLocalshortcut.unregisterAll(win);\n```\n\n# App shortcuts.\n\nThey differ from native [global-shortcuts](https://github.com/atom/electron/blob/master/docs/api/global-shortcut.md) because they doesn't interfere with other apps running on the same machine.\n\n# Shortcut behaviour.\n\nIf you register a shortcut for a window, this module unregister the shortcut when the window is hidden, unfocused or minimized, and automatically restore them when the window is restored and focused again.\n\nIf you register an app shortcut, this module unregister the shortcut when all windows of your app are hidden, unfocused or minimized, and automatically restore it when any window of your app is restored and focused again.\n\n# API\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n## register\n\nRegisters the shortcut `accelerator`on the BrowserWindow instance.\n\n**Parameters**\n\n-   `win` **BrowserWindow** BrowserWindow instance to register.\n-   `accelerator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the shortcut to register\n-   `callback` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** This function is called when the shortcut is pressed\n    and the window is focused and not minimized.\n\nReturns **[Undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)**\n\n## unregister\n\nUnregisters the shortcut of `accelerator` registered on the BrowserWindow instance.\n\n**Parameters**\n\n-   `win` **BrowserWindow** BrowserWindow instance to unregister.\n-   `accelerator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the shortcut to unregister\n\nReturns **[Undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)**\n\n## disableAll\n\nDisable all of the shortcuts registered on the BrowserWindow instance.\nRegistered shortcuts no more works on the `window` instance, but the module\nkeep a reference on them. You can reactivate them later by calling `enableAll`\nmethod on the same window instance.\n\n**Parameters**\n\n-   `win` **BrowserWindow** BrowserWindow instance\n\nReturns **[Undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)**\n\n## enableAll\n\nEnable all of the shortcuts registered on the BrowserWindow instance that\nyou had previously disabled calling `disableAll` method.\n\n**Parameters**\n\n-   `win` **BrowserWindow** BrowserWindow instance\n\nReturns **[Undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)**\n\n## unregisterAll\n\nUnregisters all of the shortcuts registered on any focused BrowserWindow\ninstance.\n\n**Parameters**\n\n-   `win` **BrowserWindow** BrowserWindow instance\n\nReturns **[Undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)**\n\n\n# License\n\nThe MIT License (MIT)\n\nCopyright (c) 2017 Andrea Parodi\n","readmeFilename":"README.md"}