Documentation ¶
Index ¶
- type EventCall
- type EventData
- type EventDispatcher
- func (e *EventDispatcher) AddEventListener(eventType string, call EventCall)
- func (e *EventDispatcher) DispatchEvent(eventType string, currentTarget interface{}, data interface{})
- func (e *EventDispatcher) OnceEventListener(eventType string, call EventCall)
- func (e *EventDispatcher) RemoveEventListener(eventType string, call EventCall, args ...bool)
- func (e *EventDispatcher) RemoveEventListenerByType(eventType string)
- func (e *EventDispatcher) RemoveEventListeners()
- type IEventDispatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventData ¶
type EventData struct { // 事件类型 EventType string // 事件传递的数据 Data interface{} // 事件当前目标 // 抛出事件时传入 CurrentTarget interface{} // 事件的发生器 // 分发事件的对象,DispatchEvent行为的所属对象,可能是内嵌对象 CurrentDispatcher IEventDispatcher // contains filtered or unexported fields }
EventData 事件数据 @author xuzhuoxi Created on 2019/01/08.
func (*EventData) StopImmediatePropagation ¶
func (ed *EventData) StopImmediatePropagation()
StopImmediatePropagation 防止对事件流中当前节点中和所有后续节点中的事件侦听器进行处理
type EventDispatcher ¶
type EventDispatcher struct {
// contains filtered or unexported fields
}
func NewEventDispatcher ¶
func NewEventDispatcher() *EventDispatcher
NewEventDispatcher 创建一个EventDispatcher
func (*EventDispatcher) AddEventListener ¶
func (e *EventDispatcher) AddEventListener(eventType string, call EventCall)
func (*EventDispatcher) DispatchEvent ¶
func (e *EventDispatcher) DispatchEvent(eventType string, currentTarget interface{}, data interface{})
func (*EventDispatcher) OnceEventListener ¶
func (e *EventDispatcher) OnceEventListener(eventType string, call EventCall)
func (*EventDispatcher) RemoveEventListener ¶
func (e *EventDispatcher) RemoveEventListener(eventType string, call EventCall, args ...bool)
func (*EventDispatcher) RemoveEventListenerByType ¶
func (e *EventDispatcher) RemoveEventListenerByType(eventType string)
func (*EventDispatcher) RemoveEventListeners ¶
func (e *EventDispatcher) RemoveEventListeners()
type IEventDispatcher ¶
type IEventDispatcher interface { // AddEventListener // 添加事件 // 重复添加会执行多次 // @param eventType 事件类型 // @param func 监听函数 AddEventListener(eventType string, call EventCall) // OnceEventListener // 添加单次执行事件 // 重复添加会执行多次 // @param eventType // @param func OnceEventListener(eventType string, call EventCall) // RemoveEventListener // 删除事件 // 只要是相同的eventType和call, 全部移除 // @param eventType 事件类型 // @param call 监听函数 // @param args 可选参数 [0]:bool stopAfterMatch RemoveEventListener(eventType string, call EventCall, args ...bool) // RemoveEventListenerByType // 删除一类事件 // @param eventType 事件类型 RemoveEventListenerByType(eventType string) // RemoveEventListeners // 清除全部事件 RemoveEventListeners() // DispatchEvent // 触发某一类型的事件 并传递数据 // @param eventType 事件类型 // @param currentTarget 当前对象 // @param data 事件的数据(可为null) DispatchEvent(eventType string, currentTarget interface{}, data interface{}) }
Click to show internal directories.
Click to hide internal directories.