Deprecate NewModel() constructors; use New() instead

This commit is contained in:
Christian Rocha
2022-01-10 18:27:33 -05:00
parent 9401ebbb83
commit b35f96cd2d
6 changed files with 41 additions and 11 deletions

View File

@@ -96,8 +96,8 @@ func (m Model) OnLastPage() bool {
return m.Page == m.TotalPages-1
}
// NewModel creates a new model with defaults.
func NewModel() Model {
// New creates a new model with defaults.
func New() Model {
return Model{
Type: Arabic,
Page: 0,
@@ -114,6 +114,11 @@ func NewModel() Model {
}
}
// NewModel creates a new model with defaults.
//
// Deprecated. Use New instead.
var NewModel = New
// Update is the Tea update function which binds keystrokes to pagination.
func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
switch msg := msg.(type) {