Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Provides a wrapper to return eventEmitters from async function calls.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
vendor
readme.mkd

readme.mkd

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);
});
Something went wrong with that request. Please try again.