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

      // #{method} invokes the given function on #{btn} events.
      func (m Map) #{method}(do func()) Map {