var port = chrome.runtime.connect({ name: "hello" }); import { contentTwitterPinLogin, renderDom, showGiveDialogHandler, showIframeHandler, hideIframeHandler, showTwitterPublishDialogHandler, setIframeRedPacket } from '../logic/twitter.js' port.onMessage.addListener(function (res) { switch (res.state) { case 'BACK_TWITTER_LOGIN_SUCCESS': showGiveDialogHandler(); break; } }) window.onload = () => { contentTwitterPinLogin(port) renderDom(port); setIframeRedPacket() } window.onmessage = (res) => { if (res.data && res.data.actionType) { switch (res.data.actionType) { case "showIframe": showIframeHandler(); break; case "hideIframe": hideIframeHandler(); break; case "showTwitterPublishDialog": showTwitterPublishDialogHandler() break; } } }