Skip to content

wilsonhut/jquery.gasp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jquery.gasp

Do jquery processing with a little breathing room

Have you ever done something like...

$("td").someBigNastyPlugin();

...and it was just too much processing for your browser? (I'm looking at you, IE)

It would be nice if your browser had a little bit of time to catch its breath while it's trying to do all that processing.

jQuery.gasp to the rescue!

Include my gasp plug-in, and replace that code above with the following, and you'll have a happy browser.

$("td").gasp(function(){
  $(this).someBigNastyPlugin();
});

Essentially, it's like jquery's .each function, but it puts a setTimeout around each one, and chains them together, one after the other. If you saw my whereas plug-in, this will make more sense.

Now this is asyncronous, but it returns a promise, so you have to treat it accordingly:

$("td").gasp(function(){
  $(this).someBigNastyPlugin();
})
.done(function(){
  console.log("This will run when it's complete");
});
console.log("This will run before the gasping is finished");

The code includes the jquery.whereas code. Just seemed easier (for you) that way.

About

Do jquery processing from a selector with a little breathing room

Resources

License

Stars

Watchers

Forks

Packages

No packages published