Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vishwam/worker-async-nextjs
Example usage of worker-async in a nextjs app
https://github.com/vishwam/worker-async-nextjs
async nextjs promisify rpc typescript web-worker worker
Last synced: about 1 month ago
JSON representation
Example usage of worker-async in a nextjs app
- Host: GitHub
- URL: https://github.com/vishwam/worker-async-nextjs
- Owner: vishwam
- License: mit
- Created: 2019-12-25T05:18:05.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T03:38:47.000Z (about 2 years ago)
- Last Synced: 2023-03-11T09:40:50.883Z (almost 2 years ago)
- Topics: async, nextjs, promisify, rpc, typescript, web-worker, worker
- Language: JavaScript
- Size: 1.49 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# worker-async-nextjs
An example app that demonstrates full-duplex promise-based communication between the browser's main thread and a web worker, using [worker-async](https://github.com/vishwam/worker-async#readme), [next.js](https://nextjs.org/), webpack, worker-loader, and typescript.## Main changes from create-next-app
* `pages/index.js`: Entry point for the application. Calls `example.main.ts` below to initialize the worker and then makes remote RPC calls to the worker.
* `workers/example.main.ts`: Initializes the worker from the main thread.
* `workers/example.worker.ts`: Entry point for the worker thread.
* `tsconfig.json`: Add typescript support to next.js.
* `next.config.js`: Add web worker support to next.js.## Getting started
### DevelopmentRun `npm run dev` to start the application in watch mode. After opening the page, you should see console logs from index.js showing the RPC requests and responses.
### Production
Run `npm run build` and `npm start`