aboutsummaryrefslogtreecommitdiff
path: root/src/background/infrastructures/ConsoleClient.js
blob: f69151545e2c16bed9375d27f453c0fbfa63e023 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import messages from '../../shared/messages';

export default class ConsoleClient {
  showCommand(tabId, command) {
    return browser.tabs.sendMessage(tabId, {
      type: messages.CONSOLE_SHOW_COMMAND,
      command,
    });
  }

  showFind(tabId) {
    return browser.tabs.sendMessage(tabId, {
      type: messages.CONSOLE_SHOW_FIND
    });
  }

  showInfo(tabId, message) {
    return browser.tabs.sendMessage(tabId, {
      type: messages.CONSOLE_SHOW_INFO,
      text: message,
    });
  }

  showError(tabId, message) {
    return browser.tabs.sendMessage(tabId, {
      type: messages.CONSOLE_SHOW_ERROR,
      text: message,
    });
  }

  hide(tabId) {
    return browser.tabs.sendMessage(tabId, {
      type: messages.CONSOLE_HIDE,
    });
  }
}