Skip to content

Commit

Permalink
abstract watcher events to use methods
Browse files Browse the repository at this point in the history
adds to the readability of the watcher file
  • Loading branch information
samccone committed Dec 11, 2013
1 parent ef1acac commit 03ff99e
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions lib/commands/watch.coffee
Expand Up @@ -9,8 +9,20 @@ exports.execute = (args)->
project = new Roots(dir)

process.stdout.write('compiling... '.grey)

project.watch()
.on('start', -> process.stdout.write('compiling... '.grey))
.on('error', console.error.bind(console))
.on('done', -> process.stdout.write('done!\n'.green))

w = project.watch()

w.on 'start', onStart
w.on 'error', onError
w.on 'done', onDone

w

onError = (err) ->
process.stdout.write JSON.stringify(err).red

onStart = ->
process.stdout.write 'compiling... '.grey

onDone = ->
process.stdout.write 'done!\n'.green

0 comments on commit 03ff99e

Please sign in to comment.