event

package
v0.0.0-...-27fe9b7 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 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 Context

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

Context represents the context of an event. Handlers of an event may call methods on the context to change the result of the event.

func C

func C() *Context

C returns a new event context.

func (*Context) After

func (ctx *Context) After(f func(cancelled bool))

After calls the function passed after the action of the event has been completed, either by a call to (*Context).Continue() or (*Context).Stop(). After can be executed multiple times to attach more functions to be called after the event is executed.

func (*Context) Cancel

func (ctx *Context) Cancel()

Cancel cancels the context.

func (*Context) Continue

func (ctx *Context) Continue(f func())

Continue calls the function f if the context is not cancelled. If it is cancelled, Continue will return immediately. These functions are not generally useful for handling events. See After() for executing code after the event happens.

func (*Context) Stop

func (ctx *Context) Stop(f func())

Stop calls the function f if the context is cancelled. If it is not cancelled, Stop will return immediately. Stop does the opposite of Continue. These functions are not generally useful for handling events. See After() for executing code after the event happens.

Jump to

Keyboard shortcuts

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