Socket
Socket
Sign inDemoInstall

greenlet

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    greenlet

Move an async function into its own thread.


Version published
Weekly downloads
794
decreased by-18.81%
Maintainers
1
Install size
3.57 kB
Created
Weekly downloads
 

Readme

Source

Greenlet

Move an async function into its own thread.

A simplified single-function version of workerize.

The name is somewhat of a poor choice, but it was available on npm.

Installation & Usage

npm i -S greenlet

Accepts an async function with, produces a copy of it that runs within a Web Worker.

greenlet(Function) -> Function

Example

import greenlet from 'greenlet'

let get = greenlet(async url => {
	let res = await fetch(url)
	return await res.json()
})

console.log(await get('/foo'))

License

MIT

Keywords

FAQs

Last updated on 26 Jan 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc