|
|
@ -7,7 +7,7 @@ import Follow from './follow'; |
|
|
|
|
|
|
|
|
|
|
|
let vvConsole = new ConsoleFrame(window); |
|
|
|
let vvConsole = new ConsoleFrame(window); |
|
|
|
|
|
|
|
|
|
|
|
const invokeEvent = (action) => { |
|
|
|
const doAction = (action) => { |
|
|
|
if (typeof action === 'undefined' || action === null) { |
|
|
|
if (typeof action === 'undefined' || action === null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -57,6 +57,18 @@ const invokeEvent = (action) => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleResponse = (response) => { |
|
|
|
|
|
|
|
if (!response) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch(response.type) { |
|
|
|
|
|
|
|
case 'response.action': |
|
|
|
|
|
|
|
doAction(response.action); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener("keypress", (e) => { |
|
|
|
window.addEventListener("keypress", (e) => { |
|
|
|
if (e.target instanceof HTMLInputElement) { |
|
|
|
if (e.target instanceof HTMLInputElement) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -69,8 +81,8 @@ window.addEventListener("keypress", (e) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
browser.runtime.sendMessage(request) |
|
|
|
browser.runtime.sendMessage(request) |
|
|
|
.then(invokeEvent, |
|
|
|
.then(handleResponse) |
|
|
|
(err) => { |
|
|
|
.catch((err) => { |
|
|
|
console.log(`Vim Vixen: ${err}`); |
|
|
|
console.log(`Vim Vixen: ${err}`); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|