@wirelineio/automerge-worker
v0.1.12
Published
Automerge doc on a worker
Downloads
5
Keywords
Readme
automerge-worker
Usage
const { createAutomergeWorker } = require('@wirelineio/automerge-worker');
// Create an instance of worker.
const worker = createAutomergeWorker();
// Use worker API.
const { changes } = await createDocument(feedKey, itemId);
const content = await getDocumentContent(itemId);
Usage with Webpack
Web
- Use the webpack plugin
CopyWebpackPlugin
to copy theautomerge.worker.js
fromdist/umd
:
{
plugins: [
new CopyWebpackPlugin: ['../../node_modules/@wirelineio/automerge-worker/dist/umd/automerge.worker.js']
]
}
Node
- Use the webpack plugin
CopyWebpackPlugin
to copy theautomerge.worker.js
fromdist/cjs
:
{
plugins: [
new CopyWebpackPlugin: ['../../node_modules/@wirelineio/automerge-worker/dist/cjs/automerge.worker.js']
]
}
Config AUTOMERGE_WORKER_PATH
The env variable AUTOMERGE_WORKER_PATH
can be set to specify the path to the worker file copied in the previous step.