Expose the Promise object type under neon::js::promise::JsPromise, using v8::Promise. This one is going to require some good experimentation and thinking around the neon async story (see #26).
@dherman I finally have some time to play with neon, will check this out :)
Just a few resources people might find handy if they want to try implementing this:
Some other things to consider:
Node.js will process the fulfillment/conclusion of the Promise in an asynchronous fashion (compared to "real-time" in JavaScript) because the fulfillment is added to the event loop's "Promise fulfillment microtask queue", which is processed immediately after the "nextTick microtask queue", even when it is fulfilled synchronously in C++.
If this ever becomes UNTRUE, then you would need to utilize an AsyncWorker (or a similar concept) in order to ensure this Promise is fulfilled asynchronously.
- Since the N-API is available since Node 8, it is worth considering supporting it for all Node versions >=8, with instead instructing developers to use a callback native API with a Promise on the JS side for versions older than that. Node 6 has less than a year of maintenance support left, after all.
- If that is not acceptable, then perhaps it is possible to automate doing that instead, or to provide a Promise through older C++ APIs. I'm unaware of nan supporting Promise creation though, so it would require more direct V8 APIs
Any update here with rust 1.39, future 0.3 and tokio 0.2 release?
Would love to do some experimentation wiring express.js controllers and actix-web services
I was also wondering the same, I am looking for a way to bind async functions to JS Promises
Most helpful comment
Just a few resources people might find handy if they want to try implementing this:
Some other things to consider: