Skip to content

Instantly share code, notes, and snippets.

@YurkaninRyan
Created March 18, 2019 12:16
Show Gist options
  • Save YurkaninRyan/9e0ef53de4492a3b499abdf7560d1a05 to your computer and use it in GitHub Desktop.
Save YurkaninRyan/9e0ef53de4492a3b499abdf7560d1a05 to your computer and use it in GitHub Desktop.
const fetch = new Effect();
function double() {
const x = fetch.throw("number");
return x * 2
}
try {
double()
} fetch.catch(resume, ...args) {
// resume lets double() continue running with the value!
if (property === "number") {
API.get("/number").then(
response => resume(response.data.number)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment