|
OLD | NEW |
---|---|
(Empty) | |
1 <!-- BEGIN AUTHORED CONTENT --> | |
2 <p> | |
3 The keybinding API allows you to add keyboard shortcuts that trigger actions in | |
4 your extension. An action can be opening the browser action or page action popup | |
5 or sending a command to the extension. | |
Mike West
2012/02/24 14:24:24
Can you add a link here to the experimental docs?
Finnur
2012/02/24 15:09:16
This is generated automatically when you build the
| |
6 </p> | |
7 | |
8 <h2 id="manifest">Manifest</h2> | |
9 | |
10 <p> | |
11 You must declare the "keybinding" permission in your extension's manifest | |
12 to use this API. Also note that "pageAction" and "browserAction" are reserved | |
Mike West
2012/02/24 14:24:24
I'd recommend separating this into two parts: `per
| |
13 commands, which, if specified, open the popup for the pageAction (if visible) | |
14 and browserAction, respectively. All other commands are sent to the extension in | |
15 the form of a javascript event. | |
16 </p> | |
17 | |
18 <pre>{ | |
19 "name": "My extension", | |
20 ... | |
21 <b> "commands": { | |
22 "toggle-feature-foo": { | |
23 "key": "Ctrl+Shift+Y", | |
24 "description": "Toggle feature foo" | |
25 }, | |
26 "browserAction": { | |
27 "key": "Ctrl+Shift+B" | |
Mike West
2012/02/24 14:24:24
Probably also worth mentioning that `Ctrl+Alt` isn
| |
28 }, | |
29 "pageAction": { | |
30 "key": "Alt+P" | |
31 } | |
32 | |
33 }</b>, | |
34 ... | |
35 <b> "permissions": [ | |
36 "keybinding", | |
37 ]</b>, | |
38 ... | |
39 }</pre> | |
40 | |
41 <h2>Examples</h2> | |
42 <p>The following example adds a handler for the onCommand event: | |
43 </p> | |
44 | |
45 <pre> | |
46 chrome.experimental.keybinding.onCommand.addListener(function(command) { | |
47 console.log('Command:', command); | |
48 }); | |
49 </pre> | |
50 <!-- END AUTHORED CONTENT --> | |
OLD | NEW |