Skip to content

Instantly share code, notes, and snippets.

@jorisroovers
Created October 2, 2013 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorisroovers/6792295 to your computer and use it in GitHub Desktop.
Save jorisroovers/6792295 to your computer and use it in GitHub Desktop.
// runner
function Runner() {
this.descriptionDefer = $.Deferred();
this.descriptionPromise = this.descriptionDefer.promise();
}
Runner.prototype.stop = function() {
this.descriptionDefer.resolve(this.descriptionDefer);
}
Runner.prototype.runSequentially = function(steps){
var self = this;
var stepCounter = 0;
self.descriptionDefer.then(null, null, function(){
if (stepCounter == steps.length){
self.descriptionDefer.resolve(self.descriptionDefer);
} else {
steps[stepCounter](self.descriptionDefer);
stepCounter++;
}
});
self.descriptionDefer.notify(); // start first step
return self.descriptionPromise;
}
function descr_welcomeModal(mydefer){
setTimeout(function(){
// backdrop has issue due to positioning + it doesn't look too good on the page
$('#welcomeModal').modal({backdrop: false});
$('#welcomeModal').on('hidden', function (){
mydefer.notify();
});
}, 500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment