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

@@ -154,8 +154,8 @@ type Model struct {
scaleRamp bool
}
// NewModel returns a model with default values.
func NewModel(opts ...Option) Model {
// New returns a model with default values.
func New(opts ...Option) Model {
m := Model{
id: nextID(),
Width: defaultWidth,
@@ -176,6 +176,11 @@ func NewModel(opts ...Option) Model {
return m
}
// NewModel returns a model with default values.
//
// Deprecated. Use New instead.
var NewModel = New
// Init exists satisfy the tea.Model interface.
func (m Model) Init() tea.Cmd {
return nil