summaryrefslogtreecommitdiffstats
path: root/plugin/hooks.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-11-02 16:23:41 -0500
committerJoram Wilander <jwawilander@gmail.com>2017-11-02 17:23:41 -0400
commitfed5324ce505c3725472af23757cd6659bb7139c (patch)
treec2ad489c627d99e30ed55e25a9f0058a7068a13a /plugin/hooks.go
parent8e81ded9ba425971bafdb8ad6bbe4b23c7420335 (diff)
downloadchat-fed5324ce505c3725472af23757cd6659bb7139c.tar.gz
chat-fed5324ce505c3725472af23757cd6659bb7139c.tar.bz2
chat-fed5324ce505c3725472af23757cd6659bb7139c.zip
Add some plugin docs (#7757)
* add some plugin docs * one more comment * spacing * example simplification
Diffstat (limited to 'plugin/hooks.go')
-rw-r--r--plugin/hooks.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugin/hooks.go b/plugin/hooks.go
index c5daec45b..a40ac0e5c 100644
--- a/plugin/hooks.go
+++ b/plugin/hooks.go
@@ -7,8 +7,14 @@ import (
"net/http"
)
+// Hooks represents an object that handles events for a plugin. Methods are likely to be added over
+// time, and plugins are not expected to implement all of them. Instead, plugins are expected to
+// implement a subset of them and pass an instance to plugin/rpcplugin.Main, which will take over
+// execution of the process and add default behaviors for missing hooks.
type Hooks interface {
- // OnActivate is invoked when the plugin is activated.
+ // OnActivate is invoked when the plugin is activated. Implementations will usually want to save
+ // the api argument for later use. Loading configuration for the first time is also a commonly
+ // done here.
OnActivate(API) error
// OnDeactivate is invoked when the plugin is deactivated. This is the plugin's last chance to