mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
set up eventSequence helper, moved pageSequence to eventSequence(changpage, fns)
This commit is contained in:
parent
eb772dfcae
commit
8b6e617309
1 changed files with 9 additions and 9 deletions
|
|
@ -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);
|
||||
Loading…
Reference in a new issue