Skip to content

Provide something like BlubirdJS ".prop" #9

@geiseri

Description

@geiseri

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"];
    });

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions