code: def display_event(div, attributes=[]):
      """
      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 {{to_string}} = Bokeh.require("core/util/pretty")
          const attrs = {attributes};
          const args = [];
          for (let i = 0; i<attrs.length; i++ ) {{
              const val = to_string(cb_obj[attrs[i]], {{precision: 2}})
              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/server/app/events_app.py
imports: import numpy
  from bokeh import events
  from bokeh.io import curdoc
  from bokeh.layouts import column, row
  from bokeh.models import Button, CustomJS, Div
  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