Using promises to provide a simple interface for a worker

So far, we've see how to use workers to perform a variety of tasks, but we've also seen that they can be cumbersome to use. This is unavoidable to some extent. However, we can provide nice interfaces to operations that are using workers with the tools we've already seen in in previous chapters.

In this recipe, we'll see how to use promises to create more familiar interfaces.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.