Refactor to keep number of parsed depths in a counter

This commit is contained in:
Ian Scott 2015-01-21 11:04:10 -08:00 committed by Ian Scott
parent 7ed7e896e1
commit bbaf2a8654

View file

@ -32,7 +32,10 @@ function readVisuals(bl, visuals, n_visuals, cb)
}); });
} }
function readDepths(bl, display, depths, n_depths, cb) function readScreens(bl, display, cbDisplayReady)
{
var numParsedDepths = 0;
var readDepths = function(bl, display, depths, n_depths, cb)
{ {
if (n_depths == 0) if (n_depths == 0)
{ {
@ -50,11 +53,11 @@ function readDepths(bl, display, depths, n_depths, cb)
for (var visual in visuals) { for (var visual in visuals) {
depths[dep][visual] = visuals[visual]; depths[dep][visual] = visuals[visual];
} }
n_depths--;
} else { } else {
depths[dep] = visuals; depths[dep] = visuals;
} }
if (Object.keys(depths).length == n_depths) numParsedDepths++;
if (numParsedDepths == n_depths)
cb(); cb();
else else
readDepths(bl, display, depths, n_depths, cb); readDepths(bl, display, depths, n_depths, cb);
@ -62,8 +65,6 @@ function readDepths(bl, display, depths, n_depths, cb)
}); });
} }
function readScreens(bl, display, cbDisplayReady)
{
// for (i=0; i < display.screen_num; ++i) // for (i=0; i < display.screen_num; ++i)
{ {
var scr = {}; var scr = {};