Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Append progress callback to FileTransfer.download() #5

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions windows8/cordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -2730,7 +2730,7 @@ FileTransfer.prototype.download = function(source, target, successCallback, erro
errorCallback(error);
};

exec(win, fail, 'FileTransfer', 'download', [source, target, trustAllHosts, this._id, headers]);
exec(win, fail, 'FileTransfer', 'download', [source, target, trustAllHosts, this._id, headers, this.onprogress]);
};

/**
Expand Down Expand Up @@ -7300,6 +7300,7 @@ module.exports = {
download:function(win, error, options) {
var source = options[0];
var target = options[1];
var progress = options[5];


if (target === null || typeof target === undefined) {
Expand Down Expand Up @@ -7328,7 +7329,13 @@ module.exports = {
win(new FileEntry(storageFile.name, storageFile.path));
}, function () {
error(FileTransferError.INVALID_URL_ERR);
});
}, function (p) {
progress && progress({
lengthComputable: true,
loaded: p.progress.bytesReceived,
total: p.progress.totalBytesToReceive
});
});
});
});
}
Expand Down Expand Up @@ -8209,4 +8216,4 @@ require('cordova/channel').onNativeReady.fire();
}(window));


})();
})();