Fork me on GitHub
#dirac
<
2016-11-14
>
danielcompton19:11:33

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

danielcompton19:11:40

I'm not quite sure where to get started

darwin21:11:49

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

darwin21:11:10

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

danielcompton21:11:15

And the Chrome devtools renders JsonML

danielcompton21:11:33

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

danielcompton21:11:37

I've read that document

danielcompton21:11:59

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

danielcompton21:11:01

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

darwin21:11:24

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

darwin21:11:49

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

darwin21:11:24

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

darwin21:11:58

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

darwin21:11:22

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

darwin21:11:48

devtools renders bodies as expandable content via disclosure triangles

danielcompton21:11:49

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

darwin21:11:56

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

darwin21:11:40

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

danielcompton21:11:16

how would I use that?

darwin21:11:25

read that google doc

darwin21:11:35

everything is documented there

darwin21:11:02

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

danielcompton21:11:46

Where does configObject come from?

darwin21:11:49

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

darwin21:11:33

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