func handleEvent(xhr js.Value, responseC chan<- Response) func(event js.Value) {
	return func(event js.Value) {
		eventType := event.Get("type").String()
		var r Response
		switch eventType {
		case "load":
			r.Code = xhr.Get("status").Int()
			r.Body = xhr.Get("response").String()
		default:
			r.err = errors.New("received event type: " + eventType)
		}
		responseC <- r
	}
}
// handleEvent handles an event for the XHR.
handleEvent handles an event for the XHR.
// handleEvent handles an event for the XHR .
func handleEvent(xhr js.Value, responseC chan<- Response) func(event js.Value) {
	return func(event js.Value) {
		eventType := event.Get("type").String()
		var r Response
		switch eventType {
		case "load":
			r.Code = xhr.Get("status").Int()
			r.Body = xhr.Get("response").String()
		default:
			r.err = errors.New("received event type: " + eventType)
		}
		responseC <- r
	}
}
func handleEvent ( xhr js . Value , responseC chan <- Response ) func ( event js . Value ) { return func ( event js . Value ) { eventType := event . Get ( " " ) . String ( ) var r Response switch eventType { case " " : r . Code = xhr . Get ( " " ) . Int ( ) r . Body = xhr . Get ( " " ) . String ( ) default : r . err = errors . New ( " " + eventType ) } responseC <- r } }
handleEvent handles an event for the XHR.
handleEvent handles an event for the XHR .