From the course: JavaScript: Web Workers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Libraries for web workers - JavaScript Tutorial
From the course: JavaScript: Web Workers
Libraries for web workers
- [Instructor] The Web Worker's API is pretty simple. But sometimes we want something even simpler. Mostly instead of loading external files or because we want to use a new design pattern. So, in this case, we can create our own library and there are some open-source libraries out there that might help. There are dozens of libraries out there. I will show you just three different libraries so you can get the idea of the kind of solutions that these libraries might give to your code. The first example is called Catiline, Catiline.js. In this case, we don't need to create a worker as an external file. It creates embedded web workers. And for that we need to create a worker with level cw function. That means Catiline worker. And we need to send a function as an argument. That function will receive data as a first argument and a callback function as a second argument. And then we need to send messages to that worker with the data function. So worker.data. We send the message. That message…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.