2018-01-04 22:06:00 +01:00
|
|
|
import { MessagingService as MessagingServiceInterface } from './abstractions/messaging.service';
|
2018-01-05 22:30:15 +01:00
|
|
|
import { PlatformUtilsService } from './abstractions/platformUtils.service';
|
2018-01-04 22:06:00 +01:00
|
|
|
|
|
|
|
export default class BrowserMessagingService implements MessagingServiceInterface {
|
2018-01-05 22:30:15 +01:00
|
|
|
constructor(private platformUtilsService: PlatformUtilsService) {
|
2018-01-04 22:06:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
send(subscriber: string, arg: any = {}) {
|
|
|
|
// if safari, else
|
|
|
|
const message = Object.assign({}, { command: subscriber }, arg);
|
|
|
|
chrome.runtime.sendMessage(message);
|
|
|
|
}
|
|
|
|
}
|