Created
March 18, 2019 12:16
-
-
Save YurkaninRyan/9e0ef53de4492a3b499abdf7560d1a05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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