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
Field Sales+ for MS Dynamics 365 and Salesforce Icon
Field Sales+ for MS Dynamics 365 and Salesforce

Maximize your sales performance on the go.

Bring Dynamics 365 and Salesforce wherever you go with Resco’s solution. With powerful offline features and reliable data syncing, your team can access CRM data on mobile devices anytime, anywhere. This saves time, cuts errors, and speeds up customer visits.
Learn More
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