syrope
November 11, 2015, 9:50pm
1
Hi, cordova filetransfer plugin works by default async.
Does anybody know how to configure sync behavior? No problem with single downloads, but when it comes to download multiple files the $scope.downloadProgress cannot be showed in a right form.
$scope.downloadProgress = parseInt( (progress.loaded / progress.total) * 100 )+'%';
so the approach could be synchronous configuration. is that possible? thank you
micrdy
February 2, 2016, 9:31am
2
Have you found a solution for this?
I was trying to achieve the same thing and the best solution I have is following:
array of stuff I want o upload
function for uploading one item with parameter containing index of file I want to upload
upload function is calling itself with parameter index+1
then you can show progress for each file.
syrope
February 2, 2016, 7:29pm
4
right, at the end something like that is what i am doing.
}, function (progress) {
$timeout(function () {
if (parseInt( (progress.loaded / progress.total) * 100) == 100 ) items_downloaded++;
$scope.downloadProgress = items_downloaded +'/'+ $scope.items_total +' items downloaded';
if ( $scope.items_total == items_downloaded ) {
$ionicLoading.hide();
}
})
});
where items_downloaded is a counter inside the foreach statement and increments every time the porcentage from a file equals 100%
syrope
February 2, 2016, 7:30pm
5
Unfortunately It seems there is no sync solution for it.