diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-11 21:45:48 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-11 21:45:48 +0900 |
commit | b2cddcd69b4ae06770d66808624fc43f3dcbcb0e (patch) | |
tree | 548eb65f678cfa1dca36773f01c635ec6c0e2066 /src/console/frames.js | |
parent | 15d39a479aa7f2c4b804bac8c4352dd0a120bc75 (diff) | |
parent | 7bc569eac745b97137e1db8b9271493b3e5c8a20 (diff) |
Merge branch 'message-passing-refactoring'
Diffstat (limited to 'src/console/frames.js')
-rw-r--r-- | src/console/frames.js | 27 |
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 }; |