github.com/git-amp/amp-sdk-go@v0.7.5/amp/support.app.go (about)

     1  package amp
     2  
     3  import "net/url"
     4  
     5  // AttrSpecs used universally
     6  const (
     7  	CellHeaderAttrSpec = "CellHeader"
     8  	CellPosAttrSpec    = "[Surface.Name]Position"
     9  )
    10  
    11  // This file contains types and interfaces intended to ease an arc app development.
    12  // These types are not required to be used, but are provided as a convenience.
    13  
    14  // AppBase is a helper for implementing AppInstance.
    15  // It is typically extended by embedding it into a struct that builds on top of it.
    16  type AppBase struct {
    17  	AppContext
    18  }
    19  
    20  func (app *AppBase) OnNew(ctx AppContext) error {
    21  	app.AppContext = ctx
    22  	return nil
    23  }
    24  
    25  func (app *AppBase) HandleURL(*url.URL) error {
    26  	return ErrUnimplemented
    27  }
    28  
    29  func (app *AppBase) OnClosing() {
    30  }
    31  
    32  func (app *AppBase) RegisterElemType(prototype ElemVal) error {
    33  	err := app.AppContext.Session().RegisterElemType(prototype)
    34  	if err != nil {
    35  		return err
    36  	}
    37  	return nil
    38  }