2021-06-07 19:25:37 +02:00
|
|
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
2018-01-04 22:06:00 +01:00
|
|
|
|
2018-01-09 20:26:20 +01:00
|
|
|
export default class BrowserMessagingService implements MessagingService {
|
2018-01-04 22:06:00 +01:00
|
|
|
send(subscriber: string, arg: any = {}) {
|
2019-08-15 22:36:49 +02:00
|
|
|
const message = Object.assign({}, { command: subscriber }, arg);
|
2021-02-03 20:36:05 +01:00
|
|
|
chrome.runtime.sendMessage(message);
|
2018-01-04 22:06:00 +01:00
|
|
|
}
|
|
|
|
}
|