Backbone.js progress bar while fetching collection

前端 未结 6 650
既然无缘
既然无缘 2021-02-09 10:43

i\'d like to show a progress bar while i update the app with fresh content. I guess the best thing to do would be to do it while calling .fetch on a collection.

The cont

6条回答
  •  天涯浪人
    2021-02-09 11:12

    Before you fetch the collection put up the progress bar. When the collection is done and you are rendering the images to the DOM add listeners to the image load events. When all the images have successfully loaded remove the progress bar.

    You will want to make sure you are also listening for load failures incase an image doesn't load since the progress bar would never get removed in that case.

提交回复
热议问题