Json_item for javascript

I am trying to defer generation of some plots in BokehJS without any python backend. Json_item is exactly what I need but it doesn’t seem to be in the javascript “embed” object. Does this exists? Is it hiding somewhere?

Thanks

@eribean There’s not a json_item on the BokehJS side at present, maybe there should be. But I think you can just construct the object that embed_item expects. Something like (untested):

const doc_json = doc.to_json()

item = {
   doc: doc_json,
   root_id: doc_json.roots.root_ids[0]
}

embed_item(doc_json, "div_id")

Thanks @Bryan, worked like a charm! Weirdly enough the rendering is consistently faster so double win!

Just an FYI, if I use

Bokeh.Plotting.show(somePlot, location)

then location expects a selector

'#div_id'

However, embed_item expects an id per your response

'div_id'