Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imwildcat/wkwebviewworkerdemo
https://github.com/imwildcat/wkwebviewworkerdemo
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/imwildcat/wkwebviewworkerdemo
- Owner: imWildCat
- Created: 2021-09-06T09:52:03.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-06T09:56:35.000Z (about 3 years ago)
- Last Synced: 2024-10-26T07:32:41.195Z (18 days ago)
- Language: Swift
- Size: 38.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WKWebViewWorkerDemo for iOS
## Background
From [this node.js documentation](https://nodejs.org/api/worker_threads.html),
> Workers (threads) are useful for performing CPU-intensive JavaScript operations. They do not help much with I/O-intensive work. The Node.js built-in asynchronous I/O operations are more efficient than Workers can be.
This project is to test the availability of [`Worker`](https://developer.mozilla.org/en-US/docs/Web/API/Worker) support in `WKWebView`.
## Get started
1. In `./web`, run `yarn && yarn build-dev`.
2. Open `WKWebViewWorkerDemo.xcodeproj` in Xcode 13 and run it.## Side notes
1. There're many ways to load the JavaScript bundle of workers. `Blob` with `raw-loader` is just one of these approaches. And it looks like a workaround.
2. Since `window` is not accessible through `Worker`'s context, it is possible to use a single JavaScript bundle for both the web page and worker.## License
MIT