UNPKG

@ng1005/chrome-extension-common

Version:

chrome扩展通用库--消息与storage

29 lines (28 loc) 1.1 kB
import MessageEventBus from "./MessageEventBus"; import { SendMessage } from "../utils/ResponseUtils"; import IMessageInterface from "../interface/IMessageInterface"; import { KeyValue } from "../types/KeyValue"; export declare class RuntimeEventBus extends MessageEventBus implements IMessageInterface { script: string; types: KeyValue; constructor(script?: string); listener(): void; /** * content2AllTabs需要中转 */ listenerBridge(): void; /** * 消息处理 * @param {*} request:any * @param {*} sender:chrome.runtime.MessageSender * @param {*} sendResponse:any */ handler(request: SendMessage, sender: chrome.runtime.MessageSender, sendResponse: any): Promise<void>; $emitContent(type: string, ...args: any): Promise<any>; $emitBackground(type: string, ...args: any): Promise<any>; $emitPopup(type: string, ...args: any): Promise<any>; $emitWindow(type: string, ...args: any): Promise<any>; $emitAllTabs(type: string, ...args: any): Promise<any>; } declare const $bus: RuntimeEventBus; export default $bus;