 ;; you must call this function to start the listener that reloads
 ;; the compiled javascript
 
-;; this is commented out because we are invoking it at the bottom of
-;; this file
-;; (fw/watch-and-reload
-;;   :jsload-callback (fn [] (ex2-reload)))
+(declare ex2-restart)
+
+(fw/start
+ {
+  :websocket-url "ws://localhost:3449/figwheel-ws"
+  :on-jsload (fn []
+               (ex2-restart)
+               ;; this is a better way to reload the cube example
+               ;; which will reload even for non-local changes
+               ;; (example.cube/stop-and-start-ex3)
+               )
+  })
 
 ;; When you are writing reloadable code you have to protect things
 ;; that you don't want defined over and over.

(ns example.core
  (:require
   [figwheel.client :as fw :include-macros true]
   [example.cube]
   [crate.core]))



;; start the app once
(defonce start-ex2 (ex2-start))
