From adcaf2aa48d0453f231268f5db168376c08e4e6b Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Fri, 1 Sep 2017 11:40:24 +0900 Subject: message passing by helper functions --- src/content/index.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/content') diff --git a/src/content/index.js b/src/content/index.js index 591aa98..ad3f740 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -1,6 +1,7 @@ import * as scrolls from './scrolls'; import * as histories from './histories'; import * as actions from '../shared/actions'; +import * as messages from '../shared/messages'; import ConsoleFrame from '../console/console-frame'; import Follow from './follow'; @@ -71,15 +72,7 @@ window.addEventListener("keypress", (e) => { }); }); -window.addEventListener('message', (e) => { - let message; - try { - message = JSON.parse(e.data); - } catch (e) { - // ignore message posted by author of web page - return; - } - +messages.receive(window, (message) => { switch (message.type) { case 'vimvixen.commandline.blur': if (cmd) { -- cgit v1.2.3