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
Run Any Workload on Compute Engine VMs Icon
Run Any Workload on Compute Engine VMs

From dev environments to AI training, choose preset or custom VMs with 1–96 vCPUs and industry-leading 99.95% uptime SLA.

Compute Engine delivers high-performance virtual machines for web apps, databases, containers, and AI workloads. Choose from general-purpose, compute-optimized, or GPU/TPU-accelerated machine types—or build custom VMs to match your exact specs. With live migration and automatic failover, your workloads stay online. New customers get $300 in free credits.
Try Compute Engine
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