Documentation ¶
Overview ¶
Package event includes event related manipulations.
Index ¶
Constants ¶
View Source
const ( // EvtCodeGOPATHNotFound indicates an event: not found $GOPATH env variable EvtCodeGOPATHNotFound = iota // EvtCodeGOROOTNotFound indicates an event: not found $GOROOT env variable EvtCodeGOROOTNotFound // EvtCodeGocodeNotFound indicates an event: not found gocode EvtCodeGocodeNotFound // EvtCodeIDEStubNotFound indicates an event: not found ide_stub EvtCodeIDEStubNotFound // EvtCodeServerInternalError indicates an event: server internal error EvtCodeServerInternalError )
Variables ¶
View Source
var EventQueue = make(chan *Event, maxQueueLength)
Global event queue.
Every event in this queue will be dispatched to each user event queue.
View Source
var UserEventQueues = queues{}
User event queues.
<sid, *UserEventQueue>
Functions ¶
Types ¶
type Event ¶
type Event struct { Code int `json:"code"` // event code Sid string `json:"sid"` // wide session id related Data interface{} `json:"data"` // event data }
Event represents an event.
type HandleFunc ¶
type HandleFunc func(event *Event)
HandleFunc represents a handler function.
func (HandleFunc) Handle ¶
func (fn HandleFunc) Handle(event *Event)
Default implementation of event handling.
type UserEventQueue ¶
type UserEventQueue struct { Sid string // wide session id related Queue chan *Event // queue Handlers []Handler // event handlers }
UserEventQueue represents a user event queue.
func (*UserEventQueue) AddHandler ¶
func (uq *UserEventQueue) AddHandler(handlers ...Handler)
AddHandler adds the specified handlers to user event queues.
Click to show internal directories.
Click to hide internal directories.