Debian Codegraph @

common.go

raw symbols SCIP
1 package wl
2
3 import (
4 "context"
5 )
6
7 type ProxyId uint32
8
9 type Dispatcher interface {
10 Dispatch(context.Context, *Event)
11 }
12
13 type Proxy interface {
14 Context() *Context
15 SetContext(c *Context)
16 Id() ProxyId
17 SetId(id ProxyId)
18 }
19
20 type BaseProxy struct {
21 id ProxyId
22 ctx *Context
23 }
24
25 func (p *BaseProxy) Id() ProxyId {
26 return p.id
27 }
28
29 func (p *BaseProxy) SetId(id ProxyId) {
30 p.id = id
31 }
32
33 func (p *BaseProxy) Context() *Context {
34 return p.ctx
35 }
36
37 func (p *BaseProxy) SetContext(c *Context) {
38 p.ctx = c
39 }
40
41 type Handler interface {
42 Handle(ev interface{})
43 }
44
45 type eventHandler struct {
46 f func(interface{})
47 }
48
49 func HandlerFunc(f func(interface{})) Handler {
50 return &eventHandler{f}
51 }
52
53 func (h *eventHandler) Handle(ev interface{}) {
54 h.f(ev)
55 }