Skip to content

developit/greenlet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

🦎 Move an async function into its own thread.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors