 (defn watch
   "Given a source directory, produce runnable JavaScript. Watch the source
    directory for changes rebuliding when necessary. Takes the same arguments as
-   cljs.closure/build."
+   cljs.closure/build in addition to :watch-fn, a function of no arguments to
+   run after a successful build."
   ([source opts]
     (watch source opts
       (if-not (nil? env/*compiler*)

          fs (.getFileSystem path)
          service (.newWatchService fs)]
      (letfn [(buildf []
                (let [start (System/nanoTime)]
                  (build source opts compiler-env)
                  (println "... done. Elapsed"
                    (/ (unchecked-subtract (System/nanoTime) start) 1e9) "seconds")
                  (flush)))
              (watch-all [^Path root]
                (Files/walkFileTree root
                  (reify

     :output-dir "samples/hello/out"
     :cache-analysis true
     :source-map true
     :verbose true
     :watch-fn
     (fn []
       (println "Success!"))})
  )

;; =============================================================================
