aboutsummaryrefslogtreecommitdiff
path: root/src/console/frames.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/console/frames.js')
-rw-r--r--src/console/frames.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/console/frames.js b/src/console/frames.js
new file mode 100644
index 0000000..0b6f3e2
--- /dev/null
+++ b/src/console/frames.js
@@ -0,0 +1,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 };