Example shows how to setup and run termdash with manually triggered redraw.
()
| 85 | |
| 86 | // Example shows how to setup and run termdash with manually triggered redraw. |
| 87 | func Example_triggered() { |
| 88 | // Create the terminal. |
| 89 | t, err := tcell.New() |
| 90 | if err != nil { |
| 91 | panic(err) |
| 92 | } |
| 93 | defer t.Close() |
| 94 | |
| 95 | // Create a widget. |
| 96 | bc, err := barchart.New() |
| 97 | if err != nil { |
| 98 | panic(err) |
| 99 | } |
| 100 | |
| 101 | // Create the container with a widget. |
| 102 | c, err := container.New( |
| 103 | t, |
| 104 | container.PlaceWidget(bc), |
| 105 | ) |
| 106 | if err != nil { |
| 107 | panic(err) |
| 108 | } |
| 109 | |
| 110 | // Create the controller and disable periodic redraw. |
| 111 | ctrl, err := NewController(t, c) |
| 112 | if err != nil { |
| 113 | panic(err) |
| 114 | } |
| 115 | // Close the controller and termdash once it isn't required anymore. |
| 116 | defer ctrl.Close() |
| 117 | |
| 118 | // Redraw the terminal manually. |
| 119 | if err := ctrl.Redraw(); err != nil { |
| 120 | panic(err) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | // errorHandler just stores the last error received. |
| 125 | type errorHandler struct { |
nothing calls this directly
no test coverage detected