Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. function Search() {
  2. var self = this;
  3. //many different items set
  4.  
  5. self.totalSize = ko.observable(total);
  6. self.uploadedSize = ko.observable(uploaded);
  7. }
  8.  
  9. var uploadProgress;
  10.  
  11. var total = 100;
  12. var uploaded = 0;
  13.  
  14. function runUploadProgress() {
  15. uploadProgress = setInterval(function () {
  16. callWebApi({
  17. api: webapi.getUploadProgress,
  18. data: null,
  19. cache: false,
  20. success: function (json) {
  21. total = json.TotalBytes;
  22. uploaded = json.TransferedBytes;
  23. console.log(total + " - " + uploaded);
  24. }
  25. });
  26. if (total == uploaded) {
  27. stopUploadProgress();
  28. }
  29. }, 1000);
  30. return true;
  31. }
  32.  
  33. function stopUploadProgress() {
  34. clearInterval(uploadProgress);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement