Added a EvtStream member function ResetHandlers()
A feature that I missed, it clears all the defined termui.Handle() calls. Also a cleaner fix for https://github.com/gizak/termui/issues/92
This commit is contained in:
parent
202925a536
commit
ecd5df9a49
@ -221,6 +221,13 @@ func findMatch(mux map[string]func(Event), path string) string {
|
|||||||
return pattern
|
return pattern
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Remove all existing defined Handlers from the map
|
||||||
|
func (es *EvtStream) ResetHandlers() {
|
||||||
|
for Path, _ := range es.Handlers {
|
||||||
|
delete(es.Handlers, Path)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (es *EvtStream) match(path string) string {
|
func (es *EvtStream) match(path string) string {
|
||||||
return findMatch(es.Handlers, path)
|
return findMatch(es.Handlers, path)
|
||||||
|
Loading…
Reference in New Issue
Block a user