diff options
author | Olivier Paroz <github@oparoz.com> | 2015-09-14 23:41:51 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-09-14 23:41:51 +0300 |
commit | f352da71c108f26933eac5950b75d9b9ed34e7e0 (patch) | |
tree | 4dbe607636e25510b2dc91b6cd3f83e868846de6 /js | |
parent | 3990aea3a96824033a70646d52c6c1496e4bef9e (diff) |
Move loading the next image to a better location
Diffstat (limited to 'js')
-rw-r--r-- | js/slideshow.js | 14 | ||||
-rw-r--r-- | js/slideshowcontrols.js | 9 |
2 files changed, 16 insertions, 7 deletions
diff --git a/js/slideshow.js b/js/slideshow.js index 75bd3451..0b28d79e 100644 --- a/js/slideshow.js +++ b/js/slideshow.js @@ -15,6 +15,7 @@ zoomablePreviewContainer: null, controls: null, imageCache: {}, + /** {Image} */ currentImage: null, errorLoadingImage: false, onStop: null, @@ -193,6 +194,19 @@ }, /** + * Shows a new image in the slideshow and preloads the next in the list + * + * @param {number} current + * @param {Object} next + */ + next: function (current, next) { + this.show(current).then(function () { + // Preloads the next image in the list + this.loadImage(next); + }.bind(this)); + }, + + /** * Stops the slideshow */ stop: function () { diff --git a/js/slideshowcontrols.js b/js/slideshowcontrols.js index ad8a6953..33267aa9 100644 --- a/js/slideshowcontrols.js +++ b/js/slideshowcontrols.js @@ -324,18 +324,13 @@ }, /** - * Shows a new image in the slideshow and preloads the next in the list - * - * @todo move to Slideshow + * Asks the slideshow for the next image * * @param {number} imageId * @private */ _updateSlideshow: function (imageId) { - this.slideshow.show(this.current).then(function () { - // Preloads the next image in the list - this.slideshow.loadImage(this.images[imageId]); - }.bind(this)); + this.slideshow.next(this.current, this.images[imageId]); }, /** |