 
   compile = ->
     clearTimeout compileTimeout
-    compileTimeout = setTimeout ->
+    compileTimeout = wait 25, ->
       fs.stat source, (err, stats) ->
         return watchErr err if err
         return if prevStats and (stats.size is prevStats.size and

        timeLog "compiled #{source}"
  path.exists jsDir, (exists) ->
    if exists then compile() else exec "mkdir -p #{jsDir}", compile

# When watching scripts, it's useful to log changes with the timestamp.
timeLog = (message) ->

        fs.readFile source, (err, code) ->
          return watchErr err if err
          compileScript(source, code.toString(), base)

  watchErr = (e) ->
    throw e unless e.code is 'ENOENT'
    removeSource source, base, yes
    compileJoin()

  try
    watcher = fs.watch source, callback = (event) ->
