ps

puredom-sync

Synchronous chaining plugin for puredom.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

1

Maintenance

Last Commit

7yrs ago

Contributors

1

Package

Dependencies

0

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

puredom-sync VersionBuild Status

A puredom plugin that lets you chain sequential asynchronous functions.


What it Does

Normally, puredom's chained selection functions run in parallel (asynchronously). They do not wait for pending operations to finish before moving on to the next chained call.

This is ideal for many cases, but it can become cumbersome when chaining animation callbacks. To solve this problem, puredom.async adds a few selector functions: sync(), async() and then().

.sync(): Run everything in the order I say

.sync() switches the chain into "sync" mode. In this mode, all chained selection functions you call will run in order.

puredom('.foo')       // anything that returns a selection
    .sync()           // switch the chain to sync mode
    .fadeOut('slow')  // fade out the selection
    .fadeIn('fast')   // `-> fade the selection back in
    .hide();          //    `-> finally, hide the selection

.async(): Run everything at once

.async() reverts the chain back to puredom's normal (asynchronous) mode.

// selection in sync mode:
var sel = puredom('.foo').sync();

// these animations run sequentially:
sel.fadeIn().fadeOut();

// back to async: (this runs prior to the animations!)
console.log(sel.async().width());

.then(): Let me know when sync() is done

.then() lets you specify a function to call once the synchronous chain's current operations have finished executing:

puredom('.foo').sync().fadeIn().fadeOut().then(function() {
    alert("fade in and out have completed");
});

License

BSD 3-Clause, see LICENSE.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial