-
Notifications
You must be signed in to change notification settings - Fork 177
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
JS Promises #552
Comments
Not yet but it's being developed, stay tuned. |
Also the early async-await support would be equally awesome: |
AFAIK v7 is single-threaded at the moment, to be able to implement promises/timeouts it would need to use some threading model, right? |
no. promises have nothing to do with threading. there are pure js implementations of promises you can use . we intend to include an implementation as part of the v7 standard library. we want to make it small enough so it can work well on embedded platforms. |
for the record, pure JS promises usually require a way to postpone invocation to the next event loop iteration (i.e. We do implement event loop and setTimeout for several platforms in https://github.com/cesanta/mongoose-iot. As an analogy, V7 is for mongoose-iot, as V8 is for node.js. A relevant thread on StackOverflow: http://stackoverflow.com/questions/12335222/settimeout-and-v8
That said, just for the craic, I tried out https://github.com/stefanpenner/es6-promise, one of the many promise polyfills (minified with That impl is about 6k in size and is not optimized for embedded, which is why we're working on making it smaller. |
this promise polyfill tries several postponing methods: if (isNode) {
scheduleFlush = useNextTick();
} else if (BrowserMutationObserver) {
scheduleFlush = useMutationObserver();
} else if (isWorker) {
scheduleFlush = useMessageChannel();
} else if (browserWindow === undefined && typeof require === 'function') {
scheduleFlush = attemptVertx();
} else {
scheduleFlush = useSetTimeout();
} I wonder which one succeeds... |
as I said, none with plain v7 (as none would work in v8). setTimeout will work with mongoose-iot |
Consider using https://github.com/bluejava/zousan that is compliant, fast and very very small in comparison to other impls. |
V7 has support JS Promises?
The text was updated successfully, but these errors were encountered: