mirror of
https://github.com/kataras/iris.git
synced 2025-03-14 08:16:28 +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`.
|
**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
|
## 4.1.3 -> 4.1.4
|
||||||
|
|
||||||
Zero front-end changes. No real improvements, developers can ignore this update.
|
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/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/>
|
<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
|
Versioning
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Current: **v4.1.4**
|
Current: **v4.1.5**
|
||||||
|
|
||||||
> Iris is an active project
|
> Iris is an active project
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ License can be found [here](LICENSE).
|
||||||
[Travis]: http://travis-ci.org/kataras/iris
|
[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 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
|
[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
|
[Release]: https://github.com/kataras/iris/releases
|
||||||
[Chat Widget]: https://img.shields.io/badge/community-chat-00BCD4.svg?style=flat-square
|
[Chat Widget]: https://img.shields.io/badge/community-chat-00BCD4.svg?style=flat-square
|
||||||
[Chat]: https://kataras.rocket.chat/channel/iris
|
[Chat]: https://kataras.rocket.chat/channel/iris
|
||||||
|
|
4
iris.go
4
iris.go
|
@ -84,7 +84,7 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Version of the iris
|
// Version of the iris
|
||||||
Version = "4.1.4"
|
Version = "4.1.5"
|
||||||
|
|
||||||
banner = ` _____ _
|
banner = ` _____ _
|
||||||
|_ _| (_)
|
|_ _| (_)
|
||||||
|
@ -211,7 +211,7 @@ func New(cfg ...config.Iris) *Framework {
|
||||||
// set the Logger
|
// set the Logger
|
||||||
s.Logger = logger.New(logger.DefaultConfig())
|
s.Logger = logger.New(logger.DefaultConfig())
|
||||||
// set the plugin container
|
// set the plugin container
|
||||||
s.Plugins = &pluginContainer{logger: s.Logger}
|
s.Plugins = newPluginContainer(s.Logger)
|
||||||
// set the templates
|
// set the templates
|
||||||
s.templates = newTemplateEngines(map[string]interface{}{
|
s.templates = newTemplateEngines(map[string]interface{}{
|
||||||
"url": s.URL,
|
"url": s.URL,
|
||||||
|
|
35
plugin.go
35
plugin.go
|
@ -123,14 +123,11 @@ type (
|
||||||
DoPreClose(*Framework)
|
DoPreClose(*Framework)
|
||||||
PreDownload(PreDownloadFunc)
|
PreDownload(PreDownloadFunc)
|
||||||
DoPreDownload(Plugin, string)
|
DoPreDownload(Plugin, string)
|
||||||
// custom event callbacks
|
|
||||||
On(string, ...func())
|
|
||||||
Call(string)
|
|
||||||
//
|
//
|
||||||
GetAll() []Plugin
|
GetAll() []Plugin
|
||||||
// GetDownloader is the only one module that is used and fire listeners at the same time in this file
|
// GetDownloader is the only one module that is used and fire listeners at the same time in this file
|
||||||
GetDownloader() PluginDownloadManager
|
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 is the interface which the DownloadManager should implements
|
||||||
PluginDownloadManager interface {
|
PluginDownloadManager interface {
|
||||||
DirectoryExists(string) bool
|
DirectoryExists(string) bool
|
||||||
|
@ -231,6 +228,11 @@ type pluginContainer struct {
|
||||||
mu sync.Mutex
|
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
|
// Add activates the plugins and if succeed then adds it to the activated plugins list
|
||||||
func (p *pluginContainer) Add(plugins ...Plugin) error {
|
func (p *pluginContainer) Add(plugins ...Plugin) error {
|
||||||
for _, plugin := range plugins {
|
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