event

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEventHandlerOneShot

func AddEventHandlerOneShot(event *Event, handler HandlerFunc)

AddEventHandlerOneShot registers event handler with event. When event fires, handler is removed from it immediately.

func HandleFired added in v0.3.0

func HandleFired()

HandleFired processes the queue of fired events and calls their handlers.

Types

type Event

type Event struct {
	// contains filtered or unexported fields
}

Event represents an event that can be fired.

func (*Event) AddHandler

func (e *Event) AddHandler(h HandlerFunc) RemoveHandlerFunc

AddHandler registers event handler with event. It returns a function to remove handler from event.

func (*Event) Fire

func (e *Event) Fire(args interface{})

Fire fires an event to all registered handlers. Arbitrary event arguments may be passed which are in turn passed on to event handlers.

Events are not fired directly, but are put into a deferred queue. This queue is then processed by the GUI.

type FiredEvent added in v0.3.0

type FiredEvent struct {
	// contains filtered or unexported fields
}

FiredEvent represents an event that has been fired.

type HandlerFunc

type HandlerFunc func(args interface{})

A HandlerFunc is a function that receives and handles an event. When firing an event using Event.Fire, arbitrary event arguments may be passed that are in turn passed on to the handler function.

type RemoveHandlerFunc

type RemoveHandlerFunc func()

RemoveHandlerFunc is a function that removes a handler from an event.

Jump to

Keyboard shortcuts

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