GitShow/developit/greenlet
developit

greenlet

๐ŸฆŽ Move an async function into its own thread.

by developit
threadweb-workerwebworkerworkerworkerize
Star on GitHubForkWebsitenpm

JavaScript

4.7k stars97 forks11 contributorsQuiet ยท 5y agoSince 20181.1.0

Meet the team

See all 11 on GitHub โ†’
developit
developit48 contributions
johnsonjo4531
johnsonjo45316 contributions
spkellydev
spkellydev4 contributions
MattSidor
MattSidor3 contributions
sylvaindumont
sylvaindumont3 contributions
styfle
styfle2 contributions
joshuaquek
joshuaquek2 contributions
DCtheTall
DCtheTall1 contribution

Languages

View on GitHub โ†’
JavaScript100%

Commit activity

Last 12 weeks ยท 0 commits

Full graph โ†’

Community health

1 of 6 standards met

Community profile โ†’
28
โœ“READMEโ—‹Licenseโ—‹Contributingโ—‹Code of Conductโ—‹Issue Templateโ—‹PR Template

Recent PRs & issues

Quiet ยท 2 in progress ยท Last activity 5y ago
See all on GitHub โ†’
fregante
ESLint/TypeScript: Any way to mark the function as external/scope-less?OpenIssue

This piece of code passes every static analyzer, ESLint and TS because they don't know that the arrow function is run in a different context: Are you aware of any way to mark the function in a way that linters/parsers know is not defined in the function?

fregante ยท 3mo ago
mayank99
support module workers?OpenIssue

Currently the worker is always created in classic mode. Since firefox now supports module workers, it would be nice to have the option for it in greenlet. It would open up some useful functionality, like dynamic imports. I can submit a PR if this sounds desirable.

mayank99 ยท 2y ago
maneetgoyal
Releasing thread and URL reference when the workerized function is not neededOpenIssue

Great library, very useful stuff and absolutely love the size. :) I've only recently started learning about and took a look at the source code. So apologies in advance if I am wrong ;). 2 things caught my eyes: So if we do something like the following snippet (taken from the README), it seems that each new function instantiated via will reserve a new thread and a new URL reference. So, if there is a case wherein I don't need to use after a certain point in my code, those resources are still trapped. They may be very less in size to be of a practical concern, but I am not sure about it and would love if anyone can comment on that. However, if the output function comes with a method which releases those references, it could be useful. WDYT? Something like: Internally, it could call: Post , can itself become so it's not callable. Or can a more informative error: . Is there a downside to this approach if the contributors already considered any similar approach?

maneetgoyal ยท 2y ago

Recent fixes

View closed PRs โ†’
marcbouchenoire
Add OffscreenCanvas to transferablesMergedPR

This PR: adds support for OffscreenCanvas as part of Greenlet's transferables list. upgrades ESLint to comply with the latest version of eslint-config-developit. upgrades to the latest Microbundle version. specifies additional exports provided by Microbundle (UMD and Modern โœจ).

marcbouchenoire ยท 3y ago
JamesLMilner
Support for terminating workers?ClosedIssue

At the moment it doesn't appear greenlet supports terminating threads. From my experimentation it appears that even if workers are not referenced they do not seem to be destroyed: !spectacle b18024 After about 20 threads the client will become unresponsive / crash. Being able to do something like: Would potentially help with the Web Worker lifecycle management.

JamesLMilner ยท 4y ago
Ayc0
Generator functionsClosedIssue

Is it possible to support generator functions in addition to async functions?

Ayc0 ยท 4y ago
Structured data for AI agents

Repository: developit/greenlet. Description: ๐ŸฆŽ Move an async function into its own thread. Stars: 4689, Forks: 97. Primary language: JavaScript. Languages: JavaScript (100%). Homepage: https://npm.im/greenlet Topics: thread, web-worker, webworker, worker, workerize. Latest release: 1.1.0 (6y ago). Open PRs: 2, open issues: 13. Last activity: 5y ago. Community health: 28%. Top contributors: developit, johnsonjo4531, spkellydev, MattSidor, sylvaindumont, styfle, joshuaquek, DCtheTall, bogas04, karol-majewski and others.

ยท@ofershap

Replace github.com with gitshow.dev