aboutsummaryrefslogtreecommitdiff
path: root/src/console/frames.js
blob: 0b6f3e2b6f147d35b79a88bd1a384c0c4f12251d (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
import './console-frame.scss';
import * as consoleActions from '../actions/console';

const initialize = (doc) => {
  let iframe = doc.createElement('iframe');
  iframe.src = browser.runtime.getURL('build/console.html');
  iframe.id = 'vimvixen-console-frame';
  iframe.className = 'vimvixen-console-frame';
  doc.body.append(iframe);

  return iframe;
}

const showCommand = (text) => {
  return browser.runtime.sendMessage(consoleActions.showCommand(text));
};

const showError = (text) => {
  return browser.runtime.sendMessage(consoleActions.showError(text));
}

const blur = (doc) => {
  let iframe = doc.getElementById('vimvixen-console-frame');
  iframe.blur();
}

export { initialize, showCommand, showError, blur };