method_and_btn.each do |method, btn|
    out.write(<<~METHOD)

      // #{method} creates a click handler that invokes the given function
      // when a #{btn} event is received.