set up eventSequence helper, moved pageSequence to eventSequence(changpage, fns)

This commit is contained in:
John Bender 2011-06-29 12:41:04 -07:00
parent eb772dfcae
commit 8b6e617309

View file

@ -75,20 +75,20 @@
});
},
// TODO move to eventSequence and invoke pageSequence with default of
// changepage event
pageSequence: function(fns, event){
pageSequence: function(fns){
this.eventSequence("changepage", fns);
},
eventSequence: function(event, fns, timedOut){
var fn = fns.shift(),
self = this;
if(fn === undefined) return;
event = event || "changepage";
if( fn === undefined ) return;
// if a changepage or defined event is never triggered
// continue in the sequence to alert possible failures
var warnTimer = setTimeout(function(){
self.pageSequence(fns, event);
self.eventSequence(event, fns, true);
}, 2000);
// bind the recursive call to the event
@ -97,12 +97,12 @@
// Let the current stack unwind before we fire off the next item in the sequence.
// TODO setTimeout(self.pageSequence, 0, [fns, event]);
setTimeout(function(){ self.pageSequence(fns, event); }, 0);
setTimeout(function(){ self.eventSequence(event, fns); }, 0);
});
// invoke the function which should, in some fashion,
// trigger the defined event
fn();
fn(timedOut);
}
};
})(jQuery);