Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Commit 709c6e9

Browse files
authored
Merge pull request #1444 from Alexander-Bliznyuk/patch-1
docs(core-concepts/multithreading-model): mention usage with webpack
2 parents acd7c5f + 20f0468 commit 709c6e9

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

docs/core-concepts/multithreading-model.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,22 @@ Workers API in NativeScript is loosely based on the [Dedicated Web Workers API](
110110
// global.onerror = function(err) {}
111111
```
112112

113+
## Usage with Webpack
114+
115+
The way to spawn a Worker with webpack differs from the way described in the Web Workers' specification (also followed by NativeScript).
116+
117+
main-view-model.js
118+
```JavaScript
119+
...
120+
121+
var workerScript = require("./workers/image-processor");
122+
var worker = new WorkerScript();
123+
worker.postMessage({ src: imageSource, mode: 'scale', options: options });
124+
125+
...
126+
```
127+
Check out the [nativescript-worker-loader](https://github.com/NativeScript/worker-loader).
128+
113129

114130
## General Guidelines
115131

@@ -135,4 +151,4 @@ The below-attached projects demonstrate, how we could use the multithreading fun
135151

136152
[non-Angular NativeScript Demo](https://github.com/NativeScript/demo-workers)
137153

138-
[NativeScript Angular Demo](https://github.com/NativeScript/worker-loader)
154+
[NativeScript Angular Demo](https://github.com/NativeScript/worker-loader)

0 commit comments

Comments
 (0)