cognitect / transit-cljs

Transit for ClojureScript
http://transit-format.org
Apache License 2.0
324 stars 21 forks source link

Documentation/fix for default handlers #47

Open wilkerlucio opened 6 years ago

wilkerlucio commented 6 years ago

Currently we are missing docs on how to use default read/write handlers. Also the current implementation only accepts "default" as string, not :default.

In case someone gets here by looking for how to make default handlers, here is some sample code:

; default write

(deftype DefaultHandler []
  Object
  (tag [this v] "unknown")
  (rep [this v] (pr-str v)))

(def write-handlers
  {"default" (DefaultHandler.)})