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

Provide something like BlubirdJS ".prop" #9

Open
geiseri opened this issue Apr 30, 2018 · 0 comments
Open

Provide something like BlubirdJS ".prop" #9

geiseri opened this issue Apr 30, 2018 · 0 comments

Comments

@geiseri
Copy link

geiseri commented Apr 30, 2018

Since we are talking "Bluebird" I wonder how hard it would be to implement Promise.prop from bluebird. I would envision this to operate similarly to QPromise::all but it would take a map instead of a sequence. I am not sure how this would translate since we cannot construct classes in C++, but what if we just used a QMap<QString, T>? An example of how this might look would be:

QMap<QString, QPromise<QByteArray>> servers({
    {"a", download(QUrl("http://a..."))}, 
    {"b", download(QUrl("http://b..."))}, 
    {"c", download(QUrl("http://c..."))}
});

QPromise::prop(servers)
    .then([](QMap<QString, QByteArray> res) {
         qDebug() << res["a"] << res["b"] << res["c"];
    });
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

2 participants