electron-localshortcut
Advanced tools
Comparing version 0.6.1 to 1.0.0
17
index.js
@@ -20,5 +20,7 @@ 'use strict'; | ||
const shortcuts = windowsWithShortcuts.get(win); | ||
shortcuts.forEach(sc => | ||
globalShortcut.unregister(sc.accelerator) | ||
); | ||
if (shortcuts) { | ||
shortcuts.forEach(sc => | ||
globalShortcut.unregister(sc.accelerator) | ||
); | ||
} | ||
} | ||
@@ -28,6 +30,7 @@ | ||
const shortcuts = windowsWithShortcuts.get(win); | ||
shortcuts.forEach(sc => | ||
globalShortcut.register(sc.accelerator, sc.callback) | ||
); | ||
if (shortcuts) { | ||
shortcuts.forEach(sc => | ||
globalShortcut.register(sc.accelerator, sc.callback) | ||
); | ||
} | ||
} | ||
@@ -34,0 +37,0 @@ |
{ | ||
"name": "electron-localshortcut", | ||
"version": "0.6.1", | ||
"version": "1.0.0", | ||
"description": "register/unregister a keyboard shortcut locally to a BrowserWindow instance, without using a Menu", | ||
@@ -21,15 +21,5 @@ "repository": "parro-it/electron-localshortcut", | ||
"devDependencies": { | ||
"electron-prebuilt": "^1.2.5", | ||
"xo": "^0.16.0" | ||
}, | ||
"xo": { | ||
"esnext": true, | ||
"envs": [ | ||
"node", | ||
"browser" | ||
], | ||
"rules": { | ||
"import/no-extraneous-dependencies": "off" | ||
} | ||
"electron": "^1.4.4", | ||
"xo": "^0.17.0" | ||
} | ||
} |
@@ -24,23 +24,23 @@ # electron-localshortcut | ||
```javascript | ||
const electronLocalshortcut = require('electron-localshortcut'); | ||
const BrowserWindow = require('electron').BrowserWindow; | ||
const electronLocalshortcut = require('electron-localshortcut'); | ||
const BrowserWindow = require('electron').BrowserWindow; | ||
const win = new BrowserWindow(); | ||
win.loadUrl('https://github.com'); | ||
win.show(); | ||
const win = new BrowserWindow(); | ||
win.loadUrl('https://github.com'); | ||
win.show(); | ||
electronLocalshortcut.register(win, 'Ctrl+A', () => { | ||
console.log('You pressed ctrl & A'); | ||
}); | ||
electronLocalshortcut.register(win, 'Ctrl+A', () => { | ||
console.log('You pressed ctrl & A'); | ||
}); | ||
electronLocalshortcut.register(win, 'Ctrl+B', () => { | ||
console.log('You pressed ctrl & B'); | ||
}); | ||
electronLocalshortcut.register(win, 'Ctrl+B', () => { | ||
console.log('You pressed ctrl & B'); | ||
}); | ||
console.log( | ||
electronLocalshortcut.isRegistered(win, 'Ctrl+A') | ||
); // true | ||
console.log( | ||
electronLocalshortcut.isRegistered(win, 'Ctrl+A') | ||
); // true | ||
electronLocalshortcut.unregister(win, 'Ctrl+A'); | ||
electronLocalshortcut.unregisterAll(win); | ||
electronLocalshortcut.unregister(win, 'Ctrl+A'); | ||
electronLocalshortcut.unregisterAll(win); | ||
@@ -132,5 +132,5 @@ | ||
Copyright (c) 2015 Andrea Parodi | ||
Copyright (c) 2016 Andrea Parodi | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
127
1
9822