Add a very simple image pool to limit the amount of new images loaded. Hoping it will fix the screen sometimes stopping.

This commit is contained in:
Simo Kinnunen
2015-04-27 17:01:13 +09:00
parent 2123a475e3
commit 94ea19c791
2 changed files with 26 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
var _ = require('lodash')
var rotator = require('./rotator')
var ImagePool = require('./imagepool')
module.exports = function DeviceScreenDirective(
$document
@@ -208,6 +209,7 @@ module.exports = function DeviceScreenDirective(
, cachedImageHeight = 0
, cssRotation = 0
, alwaysUpright = false
, imagePool = new ImagePool(6)
function applyQuirks(banner) {
element[0].classList.toggle(
@@ -288,7 +290,7 @@ module.exports = function DeviceScreenDirective(
type: 'image/jpeg'
})
var img = new Image()
var img = imagePool.next()
img.onload = function() {
updateImageArea(this)