   "Experimental JavaScript API."
   (:require [replikativ.peer :as peer]
             [replikativ.stage :as stage]
+            [replikativ.crdt.lwwr.stage :as lwwr-stage]
             [replikativ.crdt.ormap.stage :as ormap-stage]
             [goog.net.WebSocket]
             [goog.Uri]
             [goog.events]
             [replikativ.crdt.ormap.realize :as ormap-realize]
+            [replikativ.crdt.lwwr.realize :as lwwr-realize]
             [konserve.memory :as mem]
             [kabel.client :refer [client-connect!]]
             [cljs.core.async :refer [chan take! <! >!]]
             [superv.async :refer [S]]
             [taoensso.timbre :as timbre]
+            [replikativ.crdt.lwwr.core :as lwwr]
             [replikativ.crdt.ormap.core :as ormap])
   (:require-macros [superv.async :refer [go-loop-try go-try]]))
 

                                 :onNode        on-node?
                                 :createStage   createStage
                                 :newMemStore   newMemStore
                                 :ORMap         #js {:createORMap        createORMap
                                                     :streamIntoIdentity streamIntoIdentity
                                                     :associate          associate}
                                 :clientConnect client-connect!
                                 :createUUID    cljs.core/uuid

  (let [opts (js->clj opts)]
    (promise (ormap-stage/create-ormap! stage :id (get opts "id") :description (get opts "description")))))


(defn ^:export createLWWR [stage opts]
  (let [opts (js->clj opts)]
    (promise (lwwr-stage/create-lwwr! stage :id (get opts "id") :description (get opts "description")))))

(defn ^:export setRegister [stage user crdt-id register]
  (promise (lwwr-stage/set-register! stage [user crdt-id] register)))

(defn ^:export associate
  [stage user crdt-id tx-key txs]
  (let [txs (js->clj txs)]
