plugin

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event string
const (
	LOADED            Event = "initialized"
	PLUGIN_REGISTERED Event = "registered"
	SERVICE_STARTED   Event = "service"
)

type Handler

type Handler interface {
	LoadPluginDir(directory string) error
	LoadPluginPath(path string) error
	LoadPlugin(v Plugin) error
	Emit(name Event, v interface{})
	On(name Event, callback func(v interface{}))
	Walk(func(manifest *Manifest, v Plugin))
	GetPlugins() []Plugin
	GetServices() []Service
}

Handler interface, handles and provides plugins with an interface to extend and communicate with the base functionality implemention in internal/Handler.go

type Manifest

type Manifest struct {
	Name        string
	Description string
	Registered  bool
	Events      []string
}

type Plugin

type Plugin interface {
	Manifest() *Manifest
	Register(m Handler) error
}

Plugin defines a basic plugin

type Service

type Service interface {
	Plugin
	Start()
}

Service defines a basic service plugin start is run in a go routine, shortly after Handler is initialized todo: context, channel

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL