func newTermHttpView(ctl mvc.Controller, termView *TermView, proto *proto.Http, x, y int) *HttpView { v := &HttpView{ httpProto: proto, HttpRequests: util.NewRing(size), area: NewArea(x, y, 70, size+5), shutdown: make(chan int), termView: termView, Logger: log.NewPrefixLogger("view", "term", "http"), } ctl.Go(v.Run) return v }
func newWebHttpView(ctl mvc.Controller, wv *WebView, proto *proto.Http) *WebHttpView { whv := &WebHttpView{ Logger: log.NewPrefixLogger("view", "web", "http"), webview: wv, ctl: ctl, httpProto: proto, idToTxn: make(map[string]*SerializedTxn), HttpRequests: util.NewRing(20), } ctl.Go(whv.updateHttp) whv.register() return whv }
func NewTermView(ctl mvc.Controller) *TermView { // initialize terminal display termbox.Init() w, _ := termbox.Size() v := &TermView{ ctl: ctl, updates: ctl.Updates().Reg(), redraw: util.NewBroadcast(), flush: make(chan int), shutdown: make(chan int), Logger: log.NewPrefixLogger("view", "term"), area: NewArea(0, 0, w, 10), } ctl.Go(v.run) ctl.Go(v.input) return v }