diff --git a/HISTORY.md b/HISTORY.md index 7fc1f204..33e31587 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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. diff --git a/README.md b/README.md index 1f98fd49..bd2e622d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ License -Releases +Releases Practical Guide/Docs
@@ -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 diff --git a/iris.go b/iris.go index c933612c..1702fd98 100644 --- a/iris.go +++ b/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, diff --git a/plugin.go b/plugin.go index 931db534..5ad55879 100644 --- a/plugin.go +++ b/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() - } - - } -}