Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got error passed an async function into .onUpdate #108

Open
pea3nut opened this issue Jan 31, 2020 · 4 comments
Open

Got error passed an async function into .onUpdate #108

pea3nut opened this issue Jan 31, 2020 · 4 comments
Milestone

Comments

@pea3nut
Copy link

pea3nut commented Jan 31, 2020

https://codepen.io/pea3nut/pen/povXapL

@trasherdk
Copy link

What's your problem?
Describe problem/error with relevant parts of code.
I'm not going to debug for you.

@pea3nut
Copy link
Author

pea3nut commented Jan 31, 2020

Open the codepen and the web devtools bro. Only 2 line code in there.

@trasherdk
Copy link

Only 2 line code in there, so you should not have a problem describing your code, and problem here.

@kazzkiq
Copy link
Owner

kazzkiq commented Jun 4, 2020

CodeFlask .onUpdate() does not supports async functions at the moment.

Since async/await is just syntax sugar on top of Promises, you can still make your code work with .then(). So instead of doing:

flask.onUpdate(async () => {
  const data = await yourAsyncFunctionHere();
 // do something with "data" here
});

You can simply do:

flask.onUpdate(() => {
  yourAsyncFunctionHere().then(data => {
    // do something with "data" here
  });
});

@kazzkiq kazzkiq added this to the v2 milestone Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants