github.com/zly-app/zapp@v1.3.3/config/watch.wait.go (about) 1 package config 2 3 import ( 4 "sync" 5 6 "github.com/zly-app/zapp/core" 7 "github.com/zly-app/zapp/handler" 8 ) 9 10 var watchWaitWG sync.WaitGroup 11 12 func init() { 13 watchWaitWG.Add(1) 14 handler.AddHandler(handler.AfterInitializeHandler, func(app core.IApp, handlerType handler.HandlerType) { 15 watchWaitWG.Done() 16 }) 17 } 18 19 // 等待直到NewApp成功 20 func waitAppInit() { 21 watchWaitWG.Wait() 22 }