Skip to content

Commit

Permalink
Add shortcuts to save and load close #13
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartleby2718 committed Jul 8, 2019
1 parent 20cadb8 commit 3ae67ea
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
16 changes: 16 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@
],
"persistent": false
},
"commands": {
"save": {
"suggested_key": {
"default": "Alt+S",
"mac": "Alt+S"
},
"description": "__MSG_saveButton__"
},
"load": {
"suggested_key": {
"default": "Alt+Q",
"mac": "Alt+Q"
},
"description": "__MSG_loadButton__"
}
},
"icons": {
"16": "images/default.png",
"48": "images/default.png",
Expand Down
14 changes: 13 additions & 1 deletion src/background.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as constants from './constants'
import { createWebmarkFolder } from './utils'
import { createWebmarkFolder, saveClicked, loadClicked } from './utils'

chrome.runtime.onInstalled.addListener(
() => {
Expand Down Expand Up @@ -30,3 +30,15 @@ chrome.runtime.onInstalled.addListener(
);
}
)

chrome.commands.onCommand.addListener(
(command: string) => {
if (command === 'save') {
saveClicked();
}
else if (command === 'load') {
loadClicked();
}
}
);

0 comments on commit 3ae67ea

Please sign in to comment.