1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00

new Timeout, TimeoutMessage configuration fields and apps.OnApplicationRegistered listener

This commit is contained in:
Gerasimos (Makis) Maropoulos
2021-12-09 14:44:03 +02:00
parent 968a9ec06c
commit d6cfe3fe5b
9 changed files with 124 additions and 7 deletions

View File

@@ -48,3 +48,15 @@ func GetAll() []*iris.Application {
return apps
}
// OnApplicationRegistered adds a function which fires when a new application
// is registered.
func OnApplicationRegistered(listeners ...func(app *iris.Application)) {
appListeners := make([]func(context.Application), 0, len(listeners))
for i := range listeners {
appListeners = append(appListeners, func(ctxApp context.Application) {
listeners[i](ctxApp.(*iris.Application))
})
}
context.OnApplicationRegistered(appListeners...)
}