Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 656 Bytes

readme.mkd

File metadata and controls

21 lines (14 loc) · 656 Bytes

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);
});