Skip to content
/ syncem Public

Synchronizes multiple async calls, to return one callback when all are done

Notifications You must be signed in to change notification settings

uxebu/syncem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sync'em

Synchronizes multiple async calls, to return one callback when all are done. Our initial use case was synchronizing some DB calls with other async calls. Like so:

  function doMultipleThingsInParallel(){
    job.create(callback); // the `callback` is not synchronized with the `finalCallback` below
    upload.start(finalCallback);
  }

Syncem helps like this:

  function doMultipleThingsInParallel(){
    var sync = new SyncEm(finalCallback);
    job.create( sync.toBeSynced() );
    upload.start( sync.toBeSynced() );
  }

when both async jobs are done, the finalCallback is executed.

About

Synchronizes multiple async calls, to return one callback when all are done

Resources

Stars

Watchers

Forks

Packages

No packages published