aboutsummaryrefslogtreecommitdiff
path: root/src/console/console-frame.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-09-01 12:50:29 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-09-01 12:50:29 +0900
commitd5007a747cdc39b2978847cd7c012515e5169ff7 (patch)
tree862d1346ac1c013a7b6d71488303f5a82591db62 /src/console/console-frame.js
parentd51b6744679f7a0c40c5479b2cf386a6b04c34c9 (diff)
error title
Diffstat (limited to 'src/console/console-frame.js')
-rw-r--r--src/console/console-frame.js36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/console/console-frame.js b/src/console/console-frame.js
index cf72f25..f8aeeeb 100644
--- a/src/console/console-frame.js
+++ b/src/console/console-frame.js
@@ -1,19 +1,43 @@
import './console-frame.scss';
+import * as messages from '../shared/messages';
export default class ConsoleFrame {
constructor(win, initial = '') {
- let url = browser.runtime.getURL('build/console.html') +
- '#' + encodeURIComponent(initial);
-
let element = window.document.createElement('iframe');
- element.src = url;
+ element.src = browser.runtime.getURL('build/console.html');
element.className = 'vimvixen-console-frame';
win.document.body.append(element);
this.element = element;
+
+ this.hide();
+ }
+
+ showCommand(text) {
+ this.showFrame();
+
+ let message = {
+ type: 'vimvixen.console.show.command',
+ text: text
+ };
+ messages.send(this.element.contentWindow, message);
+ }
+
+ showError(text) {
+ this.showFrame();
+
+ let message = {
+ type: 'vimvixen.console.show.error',
+ text: text
+ };
+ messages.send(this.element.contentWindow, message);
+ }
+
+ showFrame() {
+ this.element.style.display = 'block';
}
- remove() {
- this.element.remove();
+ hide() {
+ this.element.style.display = 'none';
}
}