file.size is expensive

This commit is contained in:
j 2016-09-19 23:12:53 +02:00
parent 3ce0fbfb81
commit 05b9e0b942

View file

@ -30,6 +30,7 @@ pandora.chunkupload = function(options) {
chunkSize = options.size || 1024 * 1024, chunkSize = options.size || 1024 * 1024,
chunkURL, chunkURL,
file = options.file, file = options.file,
bytesAvailable = file.size,
maxRetry = -1, maxRetry = -1,
nextChunkId, nextChunkId,
paused = false, paused = false,
@ -56,6 +57,9 @@ pandora.chunkupload = function(options) {
response: response, response: response,
responseText: that.responseText responseText: that.responseText
}); });
options = null;
file = null;
request = null
} }
function initUpload() { function initUpload() {
@ -121,8 +125,7 @@ pandora.chunkupload = function(options) {
} }
function uploadChunk(chunkId) { function uploadChunk(chunkId) {
var bytesAvailable = file.size, var chunk,
chunk,
chunkOffset = chunkId * chunkSize; chunkOffset = chunkId * chunkSize;
if (aborted) { if (aborted) {