Move an async function into its own thread. A simplified single-function version of workerize, offering the same performance as direct Worker usage. Greenlet only supports browser environments, since it uses Web Workers. For use in a NodeJS environment, Web Workers must be polyfilled using a library like node-webworker. Accepts an async function with, produces a copy of it that runs within a Web Worker. Never call greenlet() dynamically. Doing so creates a new Worker thread for every call. Since Greenlets can't rely on surrounding scope anyway, it's best to always create them at the "top" of your module. Greenlet is most effective when the work being done has relatively small inputs/outputs. One such example would be fetching a network resource when only a subset of the resulting information is needed. Greenlet will even accept and optimize transferables as arguments to and from a greenlet worker function.

Features

  • Move an async function into its own thread
  • A simplified single-function version of workerize
  • Greenlet only supports browser environments
  • Web Workers must be polyfilled using a library like node-webworker
  • Greenlet is most effective when the work being done has relatively small inputs/outputs

Project Samples

Project Activity

See All Activity >

Categories

System

License

MIT License

Follow Greenlet

Greenlet Web Site

Other Useful Business Software
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Greenlet!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript System Software

Registered

2021-12-07