Add Downloader bindings

This commit is contained in:
pandamicro
2017-01-16 13:57:10 +08:00
parent 1bf1f805ca
commit bc915ddc44
10 changed files with 221 additions and 2 deletions
+12
View File
@@ -86,6 +86,18 @@ namespace cocos2d { namespace network {
int errorCode,
int errorCodeInternal,
const std::string& errorStr)> onTaskError;
void setOnFileTaskSuccess(const std::function<void(const DownloadTask& task)>& callback) {onFileTaskSuccess = callback;};
void setOnTaskProgress(const std::function<void(const DownloadTask& task,
int64_t bytesReceived,
int64_t totalBytesReceived,
int64_t totalBytesExpected)>& callback) {onTaskProgress = callback;};
void setOnTaskError(const std::function<void(const DownloadTask& task,
int errorCode,
int errorCodeInternal,
const std::string& errorStr)>& callback) {onTaskError = callback;};
std::shared_ptr<const DownloadTask> createDownloadDataTask(const std::string& srcUrl, const std::string& identifier = "");