mirror of
https://github.com/zhigang1992/wallet.git
synced 2026-01-12 22:53:27 +08:00
fix: port disconnecting
This commit is contained in:
@@ -21,9 +21,16 @@ import {
|
||||
} from '@shared/message-types';
|
||||
import { RouteUrls } from '@shared/route-urls';
|
||||
|
||||
let backgroundPort: any;
|
||||
|
||||
// Connection to background script - fires onConnect event in background script
|
||||
// and establishes two-way communication
|
||||
const backgroundPort = chrome.runtime.connect({ name: CONTENT_SCRIPT_PORT });
|
||||
function connect() {
|
||||
backgroundPort = chrome.runtime.connect({ name: CONTENT_SCRIPT_PORT });
|
||||
backgroundPort.onDisconnect.addListener(connect);
|
||||
}
|
||||
|
||||
connect();
|
||||
|
||||
// Sends message to background script that an event has fired
|
||||
function sendMessageToBackground(message: LegacyMessageFromContentScript) {
|
||||
|
||||
Reference in New Issue
Block a user