Documentation ¶
Index ¶
- func ByteCaller(handler interface{}, params ...interface{})
- func ByteSliceCaller(handler interface{}, params ...interface{})
- func CallbackCaller(handler interface{}, params ...interface{})
- func ErrorCaller(handler interface{}, params ...interface{})
- func Int16Caller(handler interface{}, params ...interface{})
- func Int16SliceCaller(handler interface{}, params ...interface{})
- func Int32Caller(handler interface{}, params ...interface{})
- func Int32SliceCaller(handler interface{}, params ...interface{})
- func Int64Caller(handler interface{}, params ...interface{})
- func Int64SliceCaller(handler interface{}, params ...interface{})
- func Int8Caller(handler interface{}, params ...interface{})
- func Int8SliceCaller(handler interface{}, params ...interface{})
- func IntCaller(handler interface{}, params ...interface{})
- func IntSliceCaller(handler interface{}, params ...interface{})
- func StringCaller(handler interface{}, params ...interface{})
- func StringSliceCaller(handler interface{}, params ...interface{})
- func Uint16Caller(handler interface{}, params ...interface{})
- func Uint16SliceCaller(handler interface{}, params ...interface{})
- func Uint32Caller(handler interface{}, params ...interface{})
- func Uint32SliceCaller(handler interface{}, params ...interface{})
- func Uint64Caller(handler interface{}, params ...interface{})
- func Uint64SliceCaller(handler interface{}, params ...interface{})
- func Uint8Caller(handler interface{}, params ...interface{})
- func Uint8SliceCaller(handler interface{}, params ...interface{})
- type Closure
- type Event
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteCaller ¶
func ByteCaller(handler interface{}, params ...interface{})
func ByteSliceCaller ¶
func ByteSliceCaller(handler interface{}, params ...interface{})
func CallbackCaller ¶
func CallbackCaller(handler interface{}, params ...interface{})
func ErrorCaller ¶
func ErrorCaller(handler interface{}, params ...interface{})
func Int16Caller ¶
func Int16Caller(handler interface{}, params ...interface{})
func Int16SliceCaller ¶
func Int16SliceCaller(handler interface{}, params ...interface{})
func Int32Caller ¶
func Int32Caller(handler interface{}, params ...interface{})
func Int32SliceCaller ¶
func Int32SliceCaller(handler interface{}, params ...interface{})
func Int64Caller ¶
func Int64Caller(handler interface{}, params ...interface{})
func Int64SliceCaller ¶
func Int64SliceCaller(handler interface{}, params ...interface{})
func Int8Caller ¶
func Int8Caller(handler interface{}, params ...interface{})
func Int8SliceCaller ¶
func Int8SliceCaller(handler interface{}, params ...interface{})
func IntSliceCaller ¶
func IntSliceCaller(handler interface{}, params ...interface{})
func StringCaller ¶
func StringCaller(handler interface{}, params ...interface{})
func StringSliceCaller ¶
func StringSliceCaller(handler interface{}, params ...interface{})
func Uint16Caller ¶
func Uint16Caller(handler interface{}, params ...interface{})
func Uint16SliceCaller ¶
func Uint16SliceCaller(handler interface{}, params ...interface{})
func Uint32Caller ¶
func Uint32Caller(handler interface{}, params ...interface{})
func Uint32SliceCaller ¶
func Uint32SliceCaller(handler interface{}, params ...interface{})
func Uint64Caller ¶
func Uint64Caller(handler interface{}, params ...interface{})
func Uint64SliceCaller ¶
func Uint64SliceCaller(handler interface{}, params ...interface{})
func Uint8Caller ¶
func Uint8Caller(handler interface{}, params ...interface{})
func Uint8SliceCaller ¶
func Uint8SliceCaller(handler interface{}, params ...interface{})
Types ¶
type Closure ¶
type Closure struct { Id uintptr Fnc interface{} }
func NewClosure ¶
func NewClosure(f interface{}) *Closure
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Example ¶
// create event object (usually exposed through a public struct that holds all the different event types) event := NewEvent(intStringCaller) // we have to wrap a function in a closure to make it identifiable closure1 := NewClosure(func(param1 int, param2 string) { fmt.Println("#1 " + param2 + ": " + strconv.Itoa(param1)) }) // multiple subscribers can attach to an event (closures can be inlined) event.Attach(closure1) event.Attach(NewClosure(func(param1 int, param2 string) { fmt.Println("#2 " + param2 + ": " + strconv.Itoa(param1)) })) // trigger the event event.Trigger(1, "Hello World") // unsubscribe the first closure and trigger again event.Detach(closure1) event.Trigger(1, "Hello World")
Output: #1 Hello World: 1 #2 Hello World: 1 #2 Hello World: 1
Click to show internal directories.
Click to hide internal directories.