lib/hey.js
function Hey(options) {

		// force the use of new
		if (this.constructor !== Hey) {
			throw "Hey must be instantiated with \"new\"!";
		}

		// we need some options, don't we?
		if (!options || !options.path) {
			throw "Option object must be set with a valid path to watch.";
		}

		// start EventEmitter
		EventEmitter.call(this);

		// folders and descriptors, just in case
		this.__paths = [];
		this.__descriptors = [];

		// helpful boolean
		this.__end_of_buffer = false;

		// some filepath properties
		this.__isDirectory = false;
		this.__isFile = false;

		Object.defineProperty(this, "isDirectory", {
			enumerable: true,
			get: function () {
				return this.__isDirectory;
			}
		 });

		Object.defineProperty(this, "isFile", {
			enumerable: true,
			get: function () {
				return this.__isFile;
			}
		 });

		// define options as "property"
		this.__options = options;

		Object.defineProperty(this, "options", {
			enumerable: true,
			get: function () {
				return this.__options;
			}
		 });

		// default mask
		Object.defineProperty(this, "defaultMask", {
			enumerable: true,
			get: function () {
				return Hey.FLAGS.MODIFY | Hey.FLAGS.CREATE | Hey.FLAGS.DELETE
					| Hey.FLAGS.SELF_DELETE | Hey.FLAGS.MOVE
					| Hey.FLAGS.SELF_MOVE;
			}
		});

		this.initialize();
	}
function Hey(options) {

		// force the use of new
		if (this.constructor !== Hey) {
			throw "Hey must be instantiated with \"new\"!";
		}

		// we need some options, don't we?
		if (!options || !options.path) {
			throw "Option object must be set with a valid path to watch.";
		}

		// start EventEmitter
		EventEmitter.call(this);

		// folders and descriptors, just in case
		this.__paths = [];
		this.__descriptors = [];

		// helpful boolean
		this.__end_of_buffer = false;

		// some filepath properties
		this.__isDirectory = false;
		this.__isFile = false;

		Object.defineProperty(this, "isDirectory", {
			enumerable: true,
			get: function () {
				return this.__isDirectory;
			}
		 });

		Object.defineProperty(this, "isFile", {
			enumerable: true,
			get: function () {
				return this.__isFile;
			}
		 });

		// define options as "property"
		this.__options = options;

		Object.defineProperty(this, "options", {
			enumerable: true,
			get: function () {
				return this.__options;
			}
		 });

		// default mask
		Object.defineProperty(this, "defaultMask", {
			enumerable: true,
			get: function () {
				return Hey.FLAGS.MODIFY | Hey.FLAGS.CREATE | Hey.FLAGS.DELETE
					| Hey.FLAGS.SELF_DELETE | Hey.FLAGS.MOVE
					| Hey.FLAGS.SELF_MOVE;
			}
		});

		this.initialize();
	}
function Hey ( options ) { // force the use of new if ( this . constructor !== Hey ) { throw "Hey must be instantiated with \"new\"!" ; } // we need some options, don't we? if ( ! options || ! options . path ) { throw "Option object must be set with a valid path to watch." ; } // start EventEmitter EventEmitter . call ( this ) ; // folders and descriptors, just in case this . __paths = [ ] ; this . __descriptors = [ ] ; // helpful boolean this . __end_of_buffer = false ; // some filepath properties this . __isDirectory = false ; this . __isFile = false ; Object . defineProperty ( this , "isDirectory" , { enumerable : true , get : function ( ) { return this . __isDirectory ; } } ) ; Object . defineProperty ( this , "isFile" , { enumerable : true , get : function ( ) { return this . __isFile ; } } ) ; // define options as "property" this . __options = options ; Object . defineProperty ( this , "options" , { enumerable : true , get : function ( ) { return this . __options ; } } ) ; // default mask Object . defineProperty ( this , "defaultMask" , { enumerable : true , get : function ( ) { return Hey . FLAGS . MODIFY | Hey . FLAGS . CREATE | Hey . FLAGS . DELETE | Hey . FLAGS . SELF_DELETE | Hey . FLAGS . MOVE | Hey . FLAGS . SELF_MOVE ; } } ) ; this . initialize ( ) ; }
class for watching a path with custom events and options
class for watching a path with custom events and options