code: def display_event(div: Div, attributes: list[str] = []) -> CustomJS:
      """
      Function to build a suitable CustomJS to display the current event
      in the div model.
      """
      style = "float: left; clear: left; font-size: 13px"
      return CustomJS(
          args=dict(div=div),
          code=f"""
          const attrs = {attributes};
          const args = [];
          for (let i = 0; i < attrs.length; i++) {{
              const val = JSON.stringify(cb_obj[attrs[i]], function(key, val) {{
                  return val.toFixed ? Number(val.toFixed(2)) : val;
              }})
              args.push(attrs[i] + '=' + val)
          }}
          const line = "<span style={style!r}><b>" + cb_obj.event_name + "</b>(" + args.join(", ") + ")</span>\\n";
          const text = div.text.concat(line);
          const lines = text.split("\\n")
          if (lines.length > 35)
              lines.shift();
          div.text = lines.join("\\n");
      """,
      )
  
file_path: bokeh/examples/interaction/js_callbacks/js_on_event.py
imports: from __future__ import annotations
  import numpy
  from bokeh import events
  from bokeh.io import curdoc, show
  from bokeh.layouts import column, row
  from bokeh.models import Button, CustomJS, Div, TextInput
  from bokeh.plotting import figure
label_desc: Use image node_id 1 for calling a global function with example usage: display_event(div, attributes) and returns: CustomJS