[Interest] setTimeout/asynchronous JS woes

Attila Csipa qt at csipa.in.rs
Thu Dec 18 00:10:23 CET 2014


Hi,

I'm trying to integrate a few JS libs into my QMLs, and am running into 
a few
issues with the JS feature set, namely a missing setTimeout (normally a part
of the window object). Now, this can be worked around, but it seems like a
massive overkill

1. It can be simulated with Timer {}, but... massive overkill, plus quite
cumbersome in case of libraries due to namespace handling...

2. setTimeout is often used just to make something asynchronous, ie

setTimeout (function () { ... }, 0);

I'm aware of WorkerScript {}, but for a JS one-liner, again, it's a massive
overkill.

Is there a better way of adapting code that uses setTimeout than what I
listed above? Forking and adding mega-clutter to JS-libs is quite 
suboptimal,
and even though there is no window object, that does not stop node.js et al
to include setTimeout....

https://codereview.qt-project.org/#/c/11033/ is 3 years in the making so I
lost hope a bit of seeing that in a release... (and yes, setTimeout would be
better than Qt.after()).

Best regards,
Attila





More information about the Interest mailing list