func (w writer) WriteMessage(field int, writeFunc func()) {
	w.Call("writeMessage", field, 0  , writeFunc)
}
WriteMessage writes a message to the buffer using writeFunc
package jspb
import "github.com/gopherjs/gopherjs/js"
type Writer interface {
	GetResult() []byte
	WriteInt32(int, int32)
	WriteInt64(int, int64)
	WriteUint32(int, uint32)
	WriteUint64(int, uint64)
	WriteSint32(int, int32)
	WriteSint64(int, int64)
	WriteFixed32(int, uint32)
	WriteFixed64(int, uint64)
	WriteSfixed32(int, int32)
	WriteSfixed64(int, int64)
	WriteFloat32(int, float32)
	WriteFloat64(int, float64)
	WriteEnum(int, int)
	WriteBool(int, bool)
	WriteString(int, string)
	WriteBytes(int, []byte)
	WriteInt32Slice(int, []int32)
	WriteInt64Slice(int, []int64)
	WriteUint32Slice(int, []uint32)
	WriteUint64Slice(int, []uint64)
	WriteSint32Slice(int, []int32)
	WriteSint64Slice(int, []int64)
	WriteFixed32Slice(int, []uint32)
	WriteFixed64Slice(int, []uint64)
	WriteSfixed32Slice(int, []int32)
	WriteSfixed64Slice(int, []int64)
	WriteFloat32Slice(int, []float32)
	WriteFloat64Slice(int, []float64)
	WriteBoolSlice(int, []bool)
	WriteEnumSlice(int, []int)
	WriteMessage(int, func())
}
type encoder struct {
	*js.Object
}
func (e encoder) WriteInt64(value int64) {
	e.Call("writeSplitVarint64", value&0xffffffff, uint64(value)>>32)
}
func (e encoder) WriteUint64(value uint64) {
	e.Call("writeSplitVarint64", value&0xffffffff, value>>32)
}
func (e encoder) WriteZigzag64(value int64) {
	v := (uint64(value) << 1) ^ uint64(value>>63)
	e.WriteUint64(v)
}
func (e encoder) WriteFixed64(value uint64) {
	e.Call("writeSplitFixed64", value&0xffffffff, value>>32)
}
func (e encoder) WriteSignedFixed64(value int64) {
	e.Call("writeSplitFixed64", value&0xffffffff, uint64(value)>>32)
}
func NewWriter() Writer {
	w := &writer{
		Object: js.Global.Get("BinaryWriter").New(),
	}
	w.encoder = &encoder{
		Object: w.Get("encoder_"),
	}
	return w
}
type writer struct {
	*js.Object
	encoder *encoder
}
type wireType int
const (
	varint wireType = iota
	fixed64
	delimited
	startGroup
	endGroup
	fixed32
)
func (w writer) GetResult() []byte {
	return w.Call("getResultBuffer").Interface().([]byte)
}
func (w writer) WriteInt32(field int, value int32) {
	w.Call("writeInt32", field, value)
}
func (w writer) WriteInt64(field int, value int64) {
	w.Call("writeFieldHeader_", field, varint)
	w.encoder.WriteInt64(value)
}
func (w writer) WriteUint32(field int, value uint32) {
	w.Call("writeUint32", field, value)
}
func (w writer) WriteUint64(field int, value uint64) {
	w.Call("writeFieldHeader_", field, varint)
	w.encoder.WriteUint64(value)
}
func (w writer) WriteSint32(field int, value int32) {
	w.Call("writeSint32", field, value)
}
func (w writer) WriteSint64(field int, value int64) {
	w.Call("writeFieldHeader_", field, varint)
	w.encoder.WriteZigzag64(value)
}
func (w writer) WriteFixed32(field int, value uint32) {
	w.Call("writeFixed32", field, value)
}
func (w writer) WriteFixed64(field int, value uint64) {
	w.Call("writeFieldHeader_", field, fixed64)
	w.encoder.WriteFixed64(value)
}
func (w writer) WriteSfixed32(field int, value int32) {
	w.Call("writeSfixed32", field, value)
}
func (w writer) WriteSfixed64(field int, value int64) {
	w.Call("writeFieldHeader_", field, fixed64)
	w.encoder.WriteSignedFixed64(value)
}
func (w writer) WriteFloat32(field int, value float32) {
	w.Call("writeFloat", field, value)
}
func (w writer) WriteFloat64(field int, value float64) {
	w.Call("writeDouble", field, value)
}
func (w writer) WriteEnum(field int, value int) {
	w.Call("writeEnum", field, value)
}
func (w writer) WriteBool(field int, value bool) {
	w.Call("writeBool", field, value)
}
func (w writer) WriteString(field int, value string) {
	w.Call("writeString", field, value)
}
func (w writer) WriteBytes(field int, value []byte) {
	w.Call("writeBytes", field, value)
}