JSFiddle - React, Tailwind, and code Playground

by gianlucaguarini

HTML

<script src="https://unpkg.com/[email protected]/dist/greenlet.umd.js"></script>
<script src="https://unpkg.com/[email protected]/erre.js"></script>

JavaScript

let getName = greenlet( async username => {
	let url = `https://api.github.com/users/${username}`
	let res = await fetch(url)
	let profile = await res.json()
	return profile.name
})

const namesStream = erre(getName)

namesStream
	.on.value(console.log)
  .on.error(console.error)

namesStream
	.push('developit')
  .push('GianlucaGuarini')