dirac

Dirac v1.7.2 is out: https://github.com/binaryage/dirac/releases/tag/v1.7.2
danielcompton 2016-11-14T19:57:33.002800Z

@darwin can you give me some pointers on how to return a hiccup representation from cljs-devtools, given a data structure?

danielcompton 2016-11-14T19:57:40.002801Z

I'm not quite sure where to get started

2016-11-14T21:18:49.002803Z

the library installs a custom formatter which produces JsonML, not hiccup

danielcompton 2016-11-14T21:18:55.002804Z

Ohhhhh

2016-11-14T21:19:10.002805Z

I internally use hiccup, but convert it at some point to JsonML

danielcompton 2016-11-14T21:19:15.002806Z

And the Chrome devtools renders JsonML

2016-11-14T21:19:19.002807Z

yes

danielcompton 2016-11-14T21:19:33.002808Z

Is there a way to get at the hiccup before it's converted?

danielcompton 2016-11-14T21:19:37.002809Z

I've read that document

danielcompton 2016-11-14T21:19:59.002810Z

I'm just not quite sure what the function entry point is

2016-11-14T21:24:47.002813Z

those functions are set into our formatter object here: https://github.com/binaryage/cljs-devtools/blob/master/src/lib/devtools/formatters.cljs#L61-L63

danielcompton 2016-11-14T21:30:01.002815Z

I can see all the pieces, but I'm not sure what I would call to put it all together?

2016-11-14T21:31:24.002816Z

it is probably not as simple as calling just one function to get whole representation

2016-11-14T21:31:49.002817Z

call header-api-call to get header JsonML for given value

2016-11-14T21:32:24.002818Z

that header might contain "object references” which you might want to embed inline and call header-api-call on them

2016-11-14T21:32:58.002819Z

also you might want to ask if given value has “body” part by calling has-body-api-call

2016-11-14T21:33:22.002820Z

and if it has, you can get body JsonML by calling body-api-call

2016-11-14T21:33:48.002821Z

devtools renders bodies as expandable content via disclosure triangles

danielcompton 2016-11-14T21:34:49.002822Z

Will it work to do this in an application that is currently using devtools?

2016-11-14T21:36:27.002823Z

yes

2016-11-14T21:36:56.002824Z

I’m not aware of any global state which would interfere with calls from custom formatter

2016-11-14T21:37:40.002825Z

btw. why don’t you use window.devtoolsFormatters directly? you would render all formatters potentially installed

danielcompton 2016-11-14T21:38:16.002827Z

how would I use that?

2016-11-14T21:38:25.002828Z

read that google doc

2016-11-14T21:38:35.002829Z

everything is documented there

2016-11-14T21:40:02.002830Z

btw. don’t forget to properly pass configObject down when inlining or expanding, cljs-devtools rely on it (there we store our “continuation” state)

danielcompton 2016-11-14T21:40:46.002831Z

Where does configObject come from?

2016-11-14T21:41:49.002837Z

search the google doc, you might get it when following object references

2016-11-14T21:43:33.002838Z

object references are kind of continuations, at those points you might decide to render them inline or wait for some user action and render them later, or never, or always, it is up to you, but config might hold some state needed for continuation