-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttppromise.cpp
More file actions
62 lines (52 loc) · 1.63 KB
/
httppromise.cpp
File metadata and controls
62 lines (52 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "httppromise.h"
#include <QDebug>
#include <QTimer>
HttpPromise::HttpPromise(QObject *parent) : QObject(parent) {}
// HttpPromise *HttpPromise::then(QJSValue callback) {
// thenCallback = callback;
// return this;
// }
// HttpPromise *HttpPromise::error(QJSValue callback) {
// catchCallback = callback;
// return this;
// }
// void HttpPromise::resolve(QString result, QString url) {
// if (settled) {
// qWarning() << " HttpPromise::resolve error: settled=> " << settled;
// return;
// }
// settled = true;
// QJSValue cb = thenCallback;
// QTimer::singleShot(0, [this, cb, result, url]() mutable {
// cb.call(QJSValueList{result, url});
// deleteLater();
// });
// }
// void HttpPromise::reject(QString error, QString url) {
// if (settled) {
// qWarning() << " HttpPromise::reject error: settled=> " << settled;
// return;
// }
// settled = true;
// QJSValue cb = catchCallback;
// QTimer::singleShot(0, [this, cb, error, url]() mutable {
// cb.call(QJSValueList{error, url});
// deleteLater();
// });
// }
// void HttpPromise::doSuccess(QString result, QString url) {
// if (settled) {
// qWarning() << " HttpPromise::resolve error: settled=> " << settled;
// return;
// }
// settled = true;
// Q_EMIT successSig(result, url);
// }
// void HttpPromise::doError(QString error, QString url) {
// if (settled) {
// qWarning() << " HttpPromise::reject error: settled=> " << settled;
// return;
// }
// settled = true;
// Q_EMIT successSig(error, url);
// }