export interface Message { message : MessageEnum ; payload : any ; } export interface ContextMenuSwitchMessage extends Message { payload : boolean ; } export enum MessageEnum { ContextMenuSwitch = 'context_menu_switch' } export default class MessageBusService { public static sendContextMenuSwitchMessage ( contextMenuState ) { const message = { message : MessageEnum . ContextMenuSwitch , payload : contextMenuState } ; this . sendMessage ( message ) ; } private static sendMessage ( message ) { chrome . runtime . sendMessage ( message ) ; } }