UNPKG

raptor

Version:

RaptorJS provides an AMD module loader that works in Node, Rhino and the web browser. It also includes various sub-modules to support building optimized web applications.

26 lines (23 loc) 831 B
define.extend( 'raptor/file-watcher', function(require) { "use strict"; var fs = require('fs'); return { watch: function(file, callback, thisObj, options) { var watcher, nodeCallback = function(eventName, filename) { callback.call(thisObj, { event: eventName, filename: file, watcher: watcher, closeWatcher: function() { watcher.close(); } }); }; watcher = fs.watch(file, nodeCallback, options); return watcher; } }; });