message-system-chrome-messenger
v0.1.1
Published
A [message-system](https://github.com/BlackGlory/message-system) messenger for Chrome extension.
Downloads
2
Readme
message-system-chrome-messenger
A message-system messenger for Chrome extension.
Client/Server
Usage
server.js
import { MessageSystem, PERMISSION } from 'message-system'
import { ChromeMessenger } from 'message-system-chrome-messenger'
const context = {
hello() {
return 'world'
}
}
const backgroundMessenger = new ChromeMessenger(true)
const ms = new MessageSystem(backgroundMessenger, [PERMISSION.RECEIVE.CALL], context)
client.js
import { MessageSystem, PERMISSION } from 'message-system'
import { ChromeMessenger } from 'message-system-chrome-messenger'
const optionsMessenger = new ChromeMessenger()
const ms = new MessageSystem(optionsMessenger, [PERMISSION.SEND.CALL])
const result = await ms.sendCallMessage(['hello'])