Transit functions for the on-the-wire EDN communication to common remotes. Includes support for Fulcro tempids, and can be extended to support additional application-specific data types.
Transit functions for the on-the-wire EDN communication to common remotes. Includes support for Fulcro tempids, and can be extended to support additional application-specific data types.
(install-type-handler! t)
Install a type handler (generated by type-handler
) into the global Fulcro transit support registry. This registry
can be used by any Fulcro-aware facility that needs to use transit for any standard purpose where app-specific type
support is desired.
Install a type handler (generated by `type-handler`) into the global Fulcro transit support registry. This registry can be used by any Fulcro-aware facility that needs to use transit for any standard purpose where app-specific type support is desired.
(read-handlers)
Returns a map that can be used for the :handlers key of a transit reader, taken from the current type handler registry.
Returns a map that can be used for the :handlers key of a transit reader, taken from the current type handler registry.
(reader in)
(reader in opts)
(reader)
(reader opts)
Create a transit reader.
opts
: (optional) options to pass to cognitect.transit/reader
(such as data type handlers).Create a transit reader. - `opts`: (optional) options to pass to `cognitect.transit/reader` (such as data type handlers).
(serializable? v)
Checks to see that the value in question can be serialized by the default fulcro writer by actually attempting to serialize it. This is not an efficient check.
Checks to see that the value in question can be serialized by the default fulcro writer by actually attempting to serialize it. This is *not* an efficient check.
(transit-clj->str data)
(transit-clj->str data opts)
Use transit to encode clj data as a string. Useful for encoding initial app state from server-side rendering.
data
: Arbitrary dataopts
: (optional) Options to send when creating a writer
. Always preserves metadata. Adding :metadata? true/false
will turn on/off metadata support. Defaults to on.Use transit to encode clj data as a string. Useful for encoding initial app state from server-side rendering. - `data`: Arbitrary data - `opts`: (optional) Options to send when creating a `writer`. Always preserves metadata. Adding :metadata? true/false will turn on/off metadata support. Defaults to on.
(transit-str->clj str)
(transit-str->clj str opts)
Use transit to decode a string into a clj data structure. Useful for decoding initial app state when starting from a server-side rendering.
Use transit to decode a string into a clj data structure. Useful for decoding initial app state when starting from a server-side rendering.
(type-handler type tag type->ground ground->type)
Creates a map that can be registered with Fulcro's transit support.
type
is a deftype
or defrecord
that represents your runtime data that you want to support in Transittag
is a string that uniquely identifies your type on the wiretype->ground
is a function that can take an instance of your type
and turn it into something transit already
knows how to handle.ground->type
is a function that can take whatever type->ground
generated and turn it back into your type
.This function returns a map that contains a :reader and :writer key. The value at these keys is suitable for merging
at the :handlers
key of a reader or writer's option map.
See also install-type-handler!
for adding this to Fulcro's registry of type support.
Creates a map that can be registered with Fulcro's transit support. * `type` is a `deftype` or `defrecord` that represents your runtime data that you want to support in Transit * `tag` is a string that uniquely identifies your type on the wire * `type->ground` is a function that can take an instance of your `type` and turn it into something transit already knows how to handle. * `ground->type` is a function that can take whatever `type->ground` generated and turn it back into your `type`. This function returns a map that contains a :reader and :writer key. The value at these keys is suitable for merging at the `:handlers` key of a reader or writer's option map. See also `install-type-handler!` for adding this to Fulcro's registry of type support.
(write-handlers)
Returns a map that can be used for the :handlers key of a transit writer, taken from the current type handler registry.
Returns a map that can be used for the :handlers key of a transit writer, taken from the current type handler registry.
(writer out)
(writer out opts)
Create a transit writer.
out
: An acceptable output for transit writers.opts
: (optional) options to pass to cognitect.transit/writer
(such as data type handlers).Create a transit writer. - `out`: An acceptable output for transit writers. - `opts`: (optional) options to pass to `cognitect.transit/writer` (such as data type handlers).
(writer)
(writer opts)
Create a transit writer.
out
: An acceptable output for transit writers.opts
: (optional) options to pass to cognitect.transit/writer
(such as handlers).Create a transit writer. - `out`: An acceptable output for transit writers. - `opts`: (optional) options to pass to `cognitect.transit/writer` (such as handlers).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close