From d781dfc78636885df7cfe3616fd52a7e21d1f5e0 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 8 Jul 2018 11:08:56 +0900 Subject: Use official redux on background --- src/background/actions/console.js | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/background/actions/console.js (limited to 'src/background/actions/console.js') diff --git a/src/background/actions/console.js b/src/background/actions/console.js new file mode 100644 index 0000000..d385b2d --- /dev/null +++ b/src/background/actions/console.js @@ -0,0 +1,41 @@ +import messages from 'shared/messages'; + +const error = async(tab, text) => { + await browser.tabs.sendMessage(tab.id, { + type: messages.CONSOLE_SHOW_ERROR, + text, + }); + return { type: '' }; +}; + +const info = async(tab, text) => { + await browser.tabs.sendMessage(tab.id, { + type: messages.CONSOLE_SHOW_INFO, + text, + }); + return { type: '' }; +}; + +const showCommand = async(tab, command) => { + await browser.tabs.sendMessage(tab.id, { + type: messages.CONSOLE_SHOW_COMMAND, + command, + }); + return { type: '' }; +}; + +const showFind = async(tab) => { + await browser.tabs.sendMessage(tab.id, { + type: messages.CONSOLE_SHOW_FIND + }); + return { type: '' }; +}; + +const hide = async(tab) => { + await browser.tabs.sendMessage(tab.id, { + type: messages.CONSOLE_HIDE, + }); + return { type: '' }; +}; + +export { error, info, showCommand, showFind, hide }; -- cgit v1.2.3