From 368fc4c082d5fcef2957d098985ae06bbeb4567b Mon Sep 17 00:00:00 2001 From: gengbing Date: Sun, 13 Jun 2021 14:58:27 +0800 Subject: [PATCH] add documents for the options --- pluginManagerSwapper.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pluginManagerSwapper.go b/pluginManagerSwapper.go index cfd340e..827b1ec 100644 --- a/pluginManagerSwapper.go +++ b/pluginManagerSwapper.go @@ -200,30 +200,35 @@ func (d Details) String() string { type Option func(mgr *PluginManagerSwapper) +// WithLogger replaces the default logger with your own. func WithLogger(log slog.Logger) Option { return func(mgr *PluginManagerSwapper) { mgr.Logger = log } } +// WithFreeDelay sets the delay time of calling OnFree. The default value is 15 seconds. func WithFreeDelay(d time.Duration) Option { return func(mgr *PluginManagerSwapper) { mgr.opts.freeDelay = d } } +// WithReloadCallback sets the callback function of reloading. func WithReloadCallback(cb ReloadCallback) Option { return func(mgr *PluginManagerSwapper) { mgr.opts.reloadCallback = cb } } +// WithExtensionNewer sets the function used to create a new object for PluginManager.Vault.Extension. func WithExtensionNewer(newExt func() interface{}) Option { return func(mgr *PluginManagerSwapper) { mgr.opts.newExt = newExt } } +// WithStaticPlugins sets the static plugins for static linking. func WithStaticPlugins(plugins map[string]*StaticPlugin) Option { return func(mgr *PluginManagerSwapper) { mgr.staticPlugins = plugins