     (notify-update path dep-graph)))
 
 
+
+
+;; ---------------------------------------------------------------------
+;; Helper Functions
+
+
+(defn add-to [type container value]
+  (if (empty? container)
+    (conj type value)
+    (conj container value)))
+
+
+(defn register-path [component store path]
+  (aset component "_paths"
+        (add-to #{} (aget component "_paths") [store path])))
+
+
+(defn build-path
+  ([path-parts] (build-path [] path-parts))
+  ([seed [part & rparts]]
+     (cond
+      (nil? part)
+      seed
+
+      (satisfies? IPath part)
+      (concat seed (path part))
+
+      :else
+      (conj seed path))))
+
+
+(defn cleanup [component]
+  (let [paths (aget  component "_paths")]
+    (doseq [[db path] paths]
+      (remove-dep! db component path))))
 
 ;; ---------------------------------------------------------------------
 ;; Simple Store Cursor

(defn store [obj]
  (-store obj))

(defprotocol INotify
  (-notify [this path]))


      ITransact
      (-transact! [_ sub-path value]
        (transact! cursor (concat path sub-path) value)))))



