message-system-worker-messenger
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

message-system-worker-messenger

A message-system messenger for Web Workers.

Usage

worker.js

import { MessageSystem, PERMISSION } from 'message-system'
import { WorkerMessenger } from 'message-system-worker-messenger' 
 
const workerMessenger = new WorkerMessenger()
const ms = new MessageSystem(workerMessenger, [PERMISSION.RECEIVE.EVAL], self)

client.js

import { MessageSystem, PERMISSION } from 'message-system'
import { WorkerMessenger } from 'message-system-worker-messenger' 
 
const worker = new Worker('worker.js')
 
const clientMessenger = new WorkerMessenger(worker)
const ms = new MessageSystem(clientMessenger, [PERMISSION.SEND.EVAL], {})
 
const result = await ms.sendEvalMessage('"hello world"')

Readme

Keywords

none

Package Sidebar

Install

npm i message-system-worker-messenger

Weekly Downloads

0

Version

0.1.8

License

MIT

Unpacked Size

156 kB

Total Files

19

Last publish

Collaborators

  • black_glory