code: function checkBgCacheStatus(element) {
        var defer = $q.defer();
  
        _checkImgCacheReady()
          .then(function() {
            ImgCache.isBackgroundCached(element, function(path, success) {
              if (success) {
                defer.resolve(path);
              } else {
                ImgCache.cacheBackground(element, function() {
                  ImgCache.isBackgroundCached(element, function(path, success) {
                    defer.resolve(path);
                  }, defer.reject);
                }, defer.reject);
              }
            }, defer.reject);
          })
          .catch(defer.reject);
  
        return defer.promise;
      }
docs: Checks elements background file cache status by element.
  @param {HTMLElement} element - element with background image.