store input keys in content script

This commit is contained in:
Shin'ya Ueoka 2017-10-07 18:38:57 +09:00
parent a6b197ca73
commit 8ff302a1f2
7 changed files with 92 additions and 119 deletions

View file

@ -1,5 +1,5 @@
import messages from 'content/messages';
import * as inputActions from 'actions/input';
import * as operationActions from 'actions/operation';
import * as settingsActions from 'actions/setting';
import * as tabActions from 'actions/tab';
import * as commands from 'shared/commands';
@ -37,9 +37,10 @@ export default class BackgroundComponent {
onMessage(message, sender) {
switch (message.type) {
case messages.KEYDOWN:
case messages.BACKGROUND_OPERATION:
return this.store.dispatch(
inputActions.keyPress(message.key, message.ctrl), sender);
operationActions.execBackground(message.operation, sender.tab),
sender);
case messages.OPEN_URL:
if (message.newTab) {
return this.store.dispatch(
@ -70,7 +71,7 @@ export default class BackgroundComponent {
}
onTabUpdated(id, info) {
if (info.url) {
if (info.status === 'complete') {
this.syncSettings(id);
}
}