mirror of
https://github.com/kataras/iris.git
synced 2025-03-14 08:26:26 +01:00
Remove unused Plugin's custom callbacks.
This commit is contained in:
parent
27e21d2685
commit
482c108839
|
@ -2,6 +2,10 @@
|
|||
|
||||
**How to upgrade**: remove your `$GOPATH/src/github.com/kataras/iris` folder, open your command-line and execute this command: `go get -u github.com/kataras/iris/iris`.
|
||||
|
||||
## 4.1.4 -> 4.1.5
|
||||
|
||||
- Remove unused Plugin's custom callbacks, if you still need them in your project use this instead: https://github.com/kataras/go-events
|
||||
|
||||
## 4.1.3 -> 4.1.4
|
||||
|
||||
Zero front-end changes. No real improvements, developers can ignore this update.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<a href="https://github.com/kataras/iris/blob/master/LICENSE"><img src="https://img.shields.io/badge/%20license-MIT%20%20License%20-E91E63.svg?style=flat-square" alt="License"></a>
|
||||
|
||||
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20release%20-%20v4.1.4%20-blue.svg?style=flat-square" alt="Releases"></a>
|
||||
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20release%20-%20v4.1.5%20-blue.svg?style=flat-square" alt="Releases"></a>
|
||||
|
||||
<a href="https://www.gitbook.com/book/kataras/iris/details"><img src="https://img.shields.io/badge/%20docs-reference-5272B4.svg?style=flat-square" alt="Practical Guide/Docs"></a><br/>
|
||||
|
||||
|
@ -160,7 +160,7 @@ I recommend writing your API tests using this new library, [httpexpect](https://
|
|||
Versioning
|
||||
------------
|
||||
|
||||
Current: **v4.1.4**
|
||||
Current: **v4.1.5**
|
||||
|
||||
> Iris is an active project
|
||||
|
||||
|
@ -195,7 +195,7 @@ License can be found [here](LICENSE).
|
|||
[Travis]: http://travis-ci.org/kataras/iris
|
||||
[License Widget]: https://img.shields.io/badge/license-MIT%20%20License%20-E91E63.svg?style=flat-square
|
||||
[License]: https://github.com/kataras/iris/blob/master/LICENSE
|
||||
[Release Widget]: https://img.shields.io/badge/release-v4.1.4-blue.svg?style=flat-square
|
||||
[Release Widget]: https://img.shields.io/badge/release-v4.1.5-blue.svg?style=flat-square
|
||||
[Release]: https://github.com/kataras/iris/releases
|
||||
[Chat Widget]: https://img.shields.io/badge/community-chat-00BCD4.svg?style=flat-square
|
||||
[Chat]: https://kataras.rocket.chat/channel/iris
|
||||
|
|
4
iris.go
4
iris.go
|
@ -84,7 +84,7 @@ import (
|
|||
|
||||
const (
|
||||
// Version of the iris
|
||||
Version = "4.1.4"
|
||||
Version = "4.1.5"
|
||||
|
||||
banner = ` _____ _
|
||||
|_ _| (_)
|
||||
|
@ -211,7 +211,7 @@ func New(cfg ...config.Iris) *Framework {
|
|||
// set the Logger
|
||||
s.Logger = logger.New(logger.DefaultConfig())
|
||||
// set the plugin container
|
||||
s.Plugins = &pluginContainer{logger: s.Logger}
|
||||
s.Plugins = newPluginContainer(s.Logger)
|
||||
// set the templates
|
||||
s.templates = newTemplateEngines(map[string]interface{}{
|
||||
"url": s.URL,
|
||||
|
|
35
plugin.go
35
plugin.go
|
@ -123,14 +123,11 @@ type (
|
|||
DoPreClose(*Framework)
|
||||
PreDownload(PreDownloadFunc)
|
||||
DoPreDownload(Plugin, string)
|
||||
// custom event callbacks
|
||||
On(string, ...func())
|
||||
Call(string)
|
||||
//
|
||||
GetAll() []Plugin
|
||||
// GetDownloader is the only one module that is used and fire listeners at the same time in this file
|
||||
GetDownloader() PluginDownloadManager
|
||||
}
|
||||
} //Note: custom event callbacks, never used internaly by Iris, but if you need them use this: github.com/kataras/go-events
|
||||
// PluginDownloadManager is the interface which the DownloadManager should implements
|
||||
PluginDownloadManager interface {
|
||||
DirectoryExists(string) bool
|
||||
|
@ -231,6 +228,11 @@ type pluginContainer struct {
|
|||
mu sync.Mutex
|
||||
}
|
||||
|
||||
// newPluginContainer receives a logger and returns a new PluginContainer
|
||||
func newPluginContainer(l *logger.Logger) PluginContainer {
|
||||
return &pluginContainer{logger: l}
|
||||
}
|
||||
|
||||
// Add activates the plugins and if succeed then adds it to the activated plugins list
|
||||
func (p *pluginContainer) Add(plugins ...Plugin) error {
|
||||
for _, plugin := range plugins {
|
||||
|
@ -449,28 +451,3 @@ func (p *pluginContainer) DoPreDownload(pluginTryToDownload Plugin, downloadURL
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// On registers a custom event
|
||||
// these are not registed as plugins, they are hidden events
|
||||
func (p *pluginContainer) On(name string, fns ...func()) {
|
||||
if p.customEvents == nil {
|
||||
p.customEvents = make(map[string][]func(), 0)
|
||||
}
|
||||
if p.customEvents[name] == nil {
|
||||
p.customEvents[name] = make([]func(), 0)
|
||||
}
|
||||
p.customEvents[name] = append(p.customEvents[name], fns...)
|
||||
}
|
||||
|
||||
// Call fires the custom event
|
||||
func (p *pluginContainer) Call(name string) {
|
||||
if p.customEvents == nil {
|
||||
return
|
||||
}
|
||||
if fns := p.customEvents[name]; fns != nil {
|
||||
for _, fn := range fns {
|
||||
fn()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user