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

Calling async functions #145

Open
joshleblanc opened this issue Jul 5, 2019 · 3 comments
Open

Calling async functions #145

joshleblanc opened this issue Jul 5, 2019 · 3 comments

Comments

@joshleblanc
Copy link

joshleblanc commented Jul 5, 2019

Apologies for asking a question in issues, but there's no mini_racer tag on SO.

If I had an async function that I wanted to call from ruby, how would I do this?

Assuming my bundle correctly polyfills promises/async/await, and I have a function

async function asyncFunction() {
  await doSomething();
  return "thing";
}

Is it possible to call this from ruby, and return "thing"?

@SamSaffron
Copy link
Collaborator

Yeah looks like we don't have promise resolution in our interop layer so the value is hidden.

What you would need to do here have a non async function resolve the promise somehow and invoke the non async thing.

I am not against building some specific async promise interop but we don't have anything now

@ianks
Copy link
Contributor

ianks commented Aug 29, 2019

Were able to do this, although we have to resolve the promise in Ruby. Our promises may be polyfilled by Babel but I'm not sure exactly.

@aspirisen
Copy link

Hi, is there some update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants