aurora

package
v0.0.0-...-07cd40f Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fire

func Fire(e Event)

func RegisterEvent

func RegisterEvent(e Event, handler EventHandler)

Types

type BaseEvent

type BaseEvent struct {
	Handlers map[int]EventHandler // All event handler functions

	Mutex sync.Mutex // Thread safety
	// contains filtered or unexported fields
}

Base structure for all events

func NewBaseEvent

func NewBaseEvent(cancellable bool) *BaseEvent

Initializes a new BaseEvent with default values

func (*BaseEvent) Cancel

func (e *BaseEvent) Cancel()

Mark the event as cancelled if it is cancellable

func (*BaseEvent) GetBaseEvent

func (e *BaseEvent) GetBaseEvent() *BaseEvent

func (*BaseEvent) IsCanceled

func (e *BaseEvent) IsCanceled() bool

Checks if the event has been cancelled

func (*BaseEvent) Register

func (e *BaseEvent) Register(handler EventHandler) int

Register an EventHandler to the event

func (*BaseEvent) Unregister

func (e *BaseEvent) Unregister(index int)

Remove an EventHandler from the event

type Event

type Event interface {
	Fire() bool                // Fire the event
	Register(EventHandler) int // Subscribe to the event
	Unregister(int)            // Unsubscribe from the event
	IsCanceled() bool          // If the event has been cancelled
	Cancel()                   // Cancels the event
}

type EventHandler

type EventHandler func(e Event) Event

type Plugin

type Plugin struct {
	Name    string        // Name of the plugin
	Author  []string      // Author(s) of the plugin
	Version PluginVersion // Plugin version info

	MainFunc func(p *Plugin) // Plugin entry point
}

func (*Plugin) Init

func (p *Plugin) Init()

func (*Plugin) Plugin

func (p *Plugin) Plugin() *Plugin

type PluginInterface

type PluginInterface interface {
	Init()
	Plugin() *Plugin
}

type PluginVersion

type PluginVersion struct {
	Version        string       // The Version tag (e.g. v1.0.0-ALPHA)
	VersionSupport map[int]bool // What versions of aurora does this plugin support
}

func (*PluginVersion) CheckVersionSupported

func (pv *PluginVersion) CheckVersionSupported(version int) bool

Check if a given version of the plugin is supported

type Runnable

type Runnable struct {
	Func func()
	// contains filtered or unexported fields
}

func (*Runnable) Cancel

func (r *Runnable) Cancel()

func (*Runnable) Run

func (r *Runnable) Run(delay time.Duration, period time.Duration)

func (*Runnable) RunAsync

func (r *Runnable) RunAsync(delay time.Duration, period time.Duration)

Directories

Path Synopsis
data
packet

Jump to

Keyboard shortcuts

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