6.7.2 • Published 5 years ago

@dws/muster-worker v6.7.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Muster Worker

Introduction

Nodes for running a Muster Graph in a standalone Worker thread.

Usage

Create a worker script, standalone from your app, and configure your worker's graph in it. Run workerConnect to enable worker messaging.

import muster from '@dws/muster';
import { workerConnect } from '@dws/muster-worker';

const graph = muster({
  // ...
});

workerConnect(graph, self);

In your app, use the worker to create a connection to the worker's graph. You'll need to pass in the path to your deployed worker script.

import muster, { ref } from '@dws/muster';
import { worker } from '@dws/muster-worker';

const clientApp = muster({
  worker: worker('./my.worker.js'),
  // ...
});

For hints on how to configure webpack to build and deploy your worker script, see the repo's webpack config.

Install

With npm installed, run

$ npm install @dws/muster-worker

License

MIT