-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
sse_event_source.go
51 lines (40 loc) · 1.19 KB
/
sse_event_source.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package http_ns
import (
"github.com/inoxlang/inox/internal/core/symbolic"
"github.com/inoxlang/inox/internal/prettyprint"
pprint "github.com/inoxlang/inox/internal/prettyprint"
)
var (
SSE_SOURCE_PROPNAMES = []string{"close"}
)
type ServerSentEventSource struct {
symbolic.UnassignablePropsMixin
_ int
}
func (r *ServerSentEventSource) Test(v symbolic.Value, state symbolic.RecTestCallState) bool {
state.StartCall()
defer state.FinishCall()
_, ok := v.(*ServerSentEventSource)
return ok
}
func (serv *ServerSentEventSource) GetGoMethod(name string) (*symbolic.GoFunction, bool) {
switch name {
case "close":
return symbolic.WrapGoMethod(serv.close), true
}
return nil, false
}
func (s *ServerSentEventSource) Prop(name string) symbolic.Value {
return symbolic.GetGoMethodOrPanic(name, s)
}
func (*ServerSentEventSource) PropertyNames() []string {
return SSE_SOURCE_PROPNAMES
}
func (serv *ServerSentEventSource) close(ctx *symbolic.Context) {
}
func (r *ServerSentEventSource) PrettyPrint(w prettyprint.PrettyPrintWriter, config *pprint.PrettyPrintConfig) {
w.WriteName("event-source")
}
func (r *ServerSentEventSource) WidestOfType() symbolic.Value {
return &ServerSentEventSource{}
}