split out the progress container getter, now progress should be panel compatible...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-01-23 09:13:59 +04:00
parent 59caf58c1f
commit 4d71983dcd
2 changed files with 17 additions and 9 deletions

View File

@ -672,7 +672,6 @@ jQuery.fn.sortChildren = function(func){
// .on('deplete', func) -> pool
//
// XXX should this be an object or a factory???
// XXX add a clean handler removal scheme (a-la jQuery event on/off)
function makeDeferredPool(size, paused){
size = size == null ? POOL_SIZE : size
size = size < 0 ? 1

View File

@ -14,13 +14,7 @@ var WORKERS = {}
/**************************************************** Progress bar ***/
// NOTE: if the progress widget gets removed without removing the worker
// this will result in dangling handlers for the previous widget...
// i.e. handlers that still reverence the original widget...
//
// XXX add a clean removal scheme...
// XXX should this have a pause button???
function makeWorkerProgressBar(name, worker, parent){
function getWorkerProgressFloatingContainer(parent){
parent = parent == null ? $('.viewer') : parent
// widget container...
@ -30,9 +24,24 @@ function makeWorkerProgressBar(name, worker, parent){
.appendTo(parent)
}
return container
}
// NOTE: if the progress widget gets removed without removing the worker
// this will result in dangling handlers for the previous widget...
// i.e. handlers that still reverence the original widget...
//
// XXX add a clean removal scheme...
// XXX should this have a pause button???
function getWorkerProgressBar(name, worker, container){
container = container == null
? getWorkerProgressFloatingContainer()
: container
var widget = $('.progress-bar[name="'+name+'"]')
// a progress bar already exists, reset it and return...
// XXX should we re-bind the event handlers here???
if(widget.length > 0){
widget
.css('display', '')
@ -109,7 +118,7 @@ function getWorkerQueue(name, pool_size, no_auto_start, no_progress){
}
if(!no_progress){
makeWorkerProgressBar(name, queue)
getWorkerProgressBar(name, queue)
}
return queue