Sha256: 8df904f551f8cdc7cc7669a25cc52b86036246650ec526a8ef8beff8bb22c023
Contents?: true
Size: 821 Bytes
Versions: 16
Compression:
Stored size: 821 Bytes
Contents
class Apiv1.ImagePreloader extends Ember.Object areWeUsingPreloader: false stillLoadingImages: [] registerImage: (source, callback) -> img = new Image() @areWeUsingPreloader = true @stillLoadingImages.pushObject img img.onload = => @stillLoadingImages.removeObject img callback img if typeof callback is "function" img.src = source preloadImagesFromCSS: -> Apiv1.ImagesToPreload.map _.bind @registerImage, @ +computed stillLoadingImages.length, areWeUsingPreloader isLoading: -> @areWeUsingPreloader and @stillLoadingImages.length > 0 Apiv1.ImagePreloader.instance = new Apiv1.ImagePreloader() Apiv1.ImagePreloader.instance.preloadImagesFromCSS() Apiv1.ImagePreloader.registerImage = _.bind Apiv1.ImagePreloader.instance.registerImage, Apiv1.ImagePreloader.instance
Version data entries
16 entries across 16 versions & 1 rubygems