Browse Source

Added Each to apply a function for every registered subapplication.

master
Benjamin Shelton 3 weeks ago
parent
commit
faac1d94ee
2 changed files with 9 additions and 0 deletions
  1. +1
    -0
      api.go
  2. +8
    -0
      application.go

+ 1
- 0
api.go View File

@ -14,6 +14,7 @@ import (
type Application interface {
AttachApplication(Application)
DestroyApplication(Application)
Each(func(Application))
Application() *application
LoadSession()
BindGroup(path string) *RouterGroup


+ 8
- 0
application.go View File

@ -165,6 +165,14 @@ func (a *application) DestroyApplication(app Application) {
}
}
// Each applies the function fn for every subapplication currently registered
// with Capstan.
func (a *application) Each(fn func(Application)) {
for _, subapp := range a.subapps {
fn(subapp)
}
}
func (a *application) Application() *application {
return a
}


Loading…
Cancel
Save