mirror of https://github.com/mum4k/termdash.git
Updated Termdash API (markdown)
parent
49d76a19f1
commit
5194a5a218
|
@ -2,7 +2,7 @@
|
|||
|
||||
[![Doc Status](https://godoc.org/github.com/mum4k/termdash?status.png)](https://godoc.org/github.com/mum4k/termdash)
|
||||
|
||||
The [termdash](https://github.com/mum4k/termdash/blob/master/termdash.go) package provides the developer with the main entry point to Termdash. This package is used to:
|
||||
The [termdash](https://github.com/mum4k/termdash/blob/master/termdash) package provides the developer with the main entry point to Termdash. This package is used to:
|
||||
|
||||
- Start and stop the application.
|
||||
- Control screen redraw.
|
||||
|
@ -13,11 +13,25 @@ The [termdash](https://github.com/mum4k/termdash/blob/master/termdash.go) packag
|
|||
|
||||
There are two main ways of how users of Termdash can controls screen redraw.
|
||||
|
||||
- Periodic time based redraw. See the **Run** function documented below.
|
||||
- Manually triggered redraw. See the **Controller** type documented below.
|
||||
- Periodic time based redraw. See the **termdash.Run** function documented below.
|
||||
- Manually triggered redraw. See the **termdash.Controller** type documented below.
|
||||
|
||||
Apart from this, Termdash will redraw the screen each time an input event happens, e.g. a keyboard, a mouse event or a terminal resize.
|
||||
|
||||
## Processing runtime errors
|
||||
|
||||
Unless an error handler is provided via the **termdash.ErrorHandler** option documented below, the Termdash application will panic on all runtime errors. A runtime error can occurs when:
|
||||
|
||||
- The terminal layer experiences an error while processing or retrieving an event.
|
||||
- A subscriber to an event (e.g. a widget) returns an error.
|
||||
- The container or a widget fails to draw itself onto the terminal.
|
||||
|
||||
## Subscribing to keyboard and mouse events
|
||||
|
||||
The container and some of the widgets subscribe to keyboard and mouse events. E.g. the **Text** widget will subscribe to mouse events in order to support scrolling of its content.
|
||||
|
||||
The developer might want to also subscribe to events so that the application can define its own keyboard shortcuts. E.g. the developer might want the application to quit when the letter 'q' is pressed. In order to do this, the developer can provide an additional **termdash.KeyboardSubscriber** or **termdash.MouseSubscriber**.
|
||||
|
||||
The public API surface of this package consists of the following:
|
||||
|
||||
## [termdash.Run](https://github.com/mum4k/termdash/blob/c861ecef303ac648f926597f28c9f44994a1ca8b/termdash.go#L91-L103):
|
||||
|
|
Loading…
Reference in New Issue