Skip to content

Commit

Permalink
Bump workerpool package in the example and update the readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
w1nklr committed Jun 28, 2024
1 parent fd6e66b commit 59e8c10
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
30 changes: 18 additions & 12 deletions examples/webpack5/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Webpack5 Workerpool Example

Warning: this example is based on the published `workerpool` package, and is not updated regularly.
Make sure to use the up-to-date package using `workerpool@latest`.

The following ensures the example uses latest `workerpool` package:

```bash
$ npm install
$ npm install workerpool@latest
$ npm run start
$ npm run build
```
Expand Down Expand Up @@ -51,18 +57,18 @@ The workerpool needs to be transformed to work properly in a webpack5 project. Y
```
3. Implement the worker in `worker.ts`:
```js
// worker.ts
```js
// worker.ts
import workerpool from 'workerpool'

// a deliberately inefficient implementation of the fibonacci sequence
function fibonacci(n) {
if (n < 2) return n;
return fibonacci(n - 2) + fibonacci(n - 1);
}

// create a worker and register public functions
workerpool.worker({
// a deliberately inefficient implementation of the fibonacci sequence
function fibonacci(n) {
if (n < 2) return n;
return fibonacci(n - 2) + fibonacci(n - 1);
}

// create a worker and register public functions
workerpool.worker({
fibonacci: fibonacci
});
```
});
```
8 changes: 4 additions & 4 deletions examples/webpack5/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"dependencies": {
"solid-js": "^1.8.7",
"workerpool": "^9.1.2"
"workerpool": "^9.1.3"
},
"devDependencies": {
"@babel/core": "^7.23.5",
Expand Down

0 comments on commit 59e8c10

Please sign in to comment.