Created
October 26, 2017 12:43
-
-
Save pajlada/dd2e2afe93daaf7b2b25fd0ed7473850 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() | |
{ | |
/// Old way | |
NetworkManager::urlFetch(QUrl("google.com"), [](auto reply) { | |
// do shit with reply | |
}); | |
// or | |
NetworkManager::urlFetch(QNetworkRequest("google.com"), [](auto reply) { | |
// do shit with reply | |
}); | |
// or | |
NetworkManager::urlFetch(QUrl("google.com"), caller, | |
[](auto reply) { | |
// do shit with reply on finished | |
}, | |
[](auto reply) { | |
// do initial shit with reply | |
}); | |
/// New way | |
NetworkRequest req("google.com"); | |
// or NetworkRequest req("google.com", caller); | |
req.onReplyCreated = [](auto reply) { | |
// handle when the reply is created | |
}; | |
req.start([](auto reply) { | |
// on reply finished | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment