mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-25 07:15:20 +02:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user