github.com/zly-app/zapp@v1.3.3/component.go (about) 1 /* 2 ------------------------------------------------- 3 Author : zlyuancn 4 date: 2021/1/20 5 Description : 6 ------------------------------------------------- 7 */ 8 9 package zapp 10 11 import ( 12 "github.com/zly-app/zapp/component" 13 "github.com/zly-app/zapp/core" 14 ) 15 16 // 构建组件 17 func (app *appCli) makeComponent() { 18 app.component = component.NewComponent(app) 19 if app.opt.CustomComponentFn != nil { 20 app.component = app.opt.CustomComponentFn(app) 21 component.ResetComponent(app.component) 22 } 23 } 24 25 // 释放组件资源 26 func (app *appCli) releaseComponentResource() { 27 app.Debug("释放组件资源") 28 app.component.Close() 29 } 30 31 func (app *appCli) GetComponent() core.IComponent { 32 return app.component 33 }