Updated Termdash API (markdown)

Jakub Sobon 2019-02-24 18:14:18 -05:00
parent 58effb3de2
commit bdfbf0243b
1 changed files with 15 additions and 1 deletions

@ -62,6 +62,19 @@ if err := termdash.Run(ctx, t, c); err != nil {
}
```
## [termdash.RedrawInterval](https://github.com/mum4k/termdash/blob/275d95ad418b6ecca8817de4b013b440fc9abbe6/termdash.go#L55-L62)
The **termdash.RedrawInterval** is used to specify how often will the screen redraw when starting Termdash via the **termdash.Run** function. This option is ignored when using the **termdash.NewController**.
The following code snippet shows how to run a Termdash application that will redraw every three seconds:
```go
// Create context ctx, terminal t and container c as in the examples above.
if err := termdash.Run(ctx, t, c, termdash.RedrawInterval(3 * time.Second)); err != nil {
return fmt.Errorf("termdash.Run => %v", err)
}
```
## [termdash.NewController](https://github.com/mum4k/termdash/blob/ffbf88caeddb1735dcf2a5f735eec80dc9cf9fe7/termdash.go#L113-L130):
The **NewController** function creates a new **Controller** instance which allows the user to manually trigger a screen redraw. Periodic redraws are disabled in this mode. Termdash will still redraw the screen each time an input event happens, e.g. a keyboard, a mouse event or a terminal resize.
@ -121,4 +134,5 @@ if err != nil {
return fmt.Errorf("termdash.NewController => %v", err)
}
defer ctrl.Close()
```
```
## [termdash.ErrorHandler](https://github.com/mum4k/termdash/blob/1c6947618b08ae236959763efd07278be5f03211/termdash.go#L64-L71):