Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (14 sloc) 0.656 kb

Syn

Syn is a simple wrapper function, that returns an EventEmitter providing simple access to two events "started" and "finished". It's primary aid is in helping track when asynchronus functions have completed. It assumes that the callbacks you pass into the async functions are synchronus.

Examples

In this example, path will only be removed after stat is called.

var sys = require('sys')
var fs = require('fs')
var syn = require('syn')

var path = "/tmp";

var s = syn.track(fs.stat, [path], function (err, stat) {
  sys.log(stat);
});

s.addListener("finished", function () {
  fs.remove(path);
});
Jump to Line
Something went wrong with that request. Please try again.