@ -153,6 +153,24 @@ $.fn.progress = function(parameters) {
}
} ,
bind : {
transitionEnd : function ( callback ) {
var
transitionEnd = module . get . transitionEnd ( )
;
$bar
. one ( transitionEnd + eventNamespace , function ( event ) {
clearTimeout ( module . failSafeTimer ) ;
callback . call ( this , event ) ;
} )
;
module . failSafeTimer = setTimeout ( function ( ) {
$bar . triggerHandler ( transitionEnd ) ;
} , settings . duration + settings . failSafeDelay ) ;
module . verbose ( 'Adding fail safe timer' , module . timer ) ;
}
} ,
increment : function ( incrementValue ) {
var
maxValue ,
@ -449,7 +467,7 @@ $.fn.progress = function(parameters) {
}
;
clearInterval ( module . interval ) ;
$bar . one ( transitionEnd + eventNamespace , animationCallback ) ;
module . bind . transitionEnd ( animationCallback ) ;
animating = true ;
module . interval = setInterval ( function ( ) {
var
@ -526,7 +544,7 @@ $.fn.progress = function(parameters) {
if ( text ) {
module . set . label ( text ) ;
}
$bar . one ( transitionEnd + eventNamespace , function ( ) {
module . bind . transitionEnd ( function ( ) {
settings . onActive . call ( element , module . value , module . total ) ;
} ) ;
} ,
@ -546,7 +564,7 @@ $.fn.progress = function(parameters) {
text = settings . onLabelUpdate ( 'active' , text , module . value , module . total ) ;
module . set . label ( text ) ;
}
$bar . one ( transitionEnd + eventNamespace , function ( ) {
module . bind . transitionEnd ( function ( ) {
settings . onSuccess . call ( element , module . total ) ;
} ) ;
} ,
@ -562,7 +580,7 @@ $.fn.progress = function(parameters) {
if ( text ) {
module . set . label ( text ) ;
}
$bar . one ( transitionEnd + eventNamespace , function ( ) {
module . bind . transitionEnd ( function ( ) {
settings . onWarning . call ( element , module . value , module . total ) ;
} ) ;
} ,
@ -578,7 +596,7 @@ $.fn.progress = function(parameters) {
if ( text ) {
module . set . label ( text ) ;
}
$bar . one ( transitionEnd + eventNamespace , function ( ) {
module . bind . transitionEnd ( function ( ) {
settings . onError . call ( element , module . value , module . total ) ;
} ) ;
} ,
@ -856,6 +874,9 @@ $.fn.progress.settings = {
total : false ,
value : false ,
// delay in ms for fail safe animation callback
failSafeDelay : 100 ,
onLabelUpdate : function ( state , text , value , total ) {
return text ;
} ,