@@ -33,7 +33,7 @@ func New(url string, protocols []string) (c WebSocket, err error) {
3333 c = WebSocket {}
3434 })
3535
36- jsProtocols := make ([]interface {} , len (protocols ))
36+ jsProtocols := make ([]any , len (protocols ))
3737 for i , p := range protocols {
3838 jsProtocols [i ] = p
3939 }
@@ -57,7 +57,7 @@ func (c WebSocket) setBinaryType(typ string) {
5757}
5858
5959func (c WebSocket ) addEventListener (eventType string , fn func (e js.Value )) func () {
60- f := js .FuncOf (func (this js.Value , args []js.Value ) interface {} {
60+ f := js .FuncOf (func (this js.Value , args []js.Value ) any {
6161 fn (args [0 ])
6262 return nil
6363 })
@@ -97,7 +97,7 @@ func (c WebSocket) OnError(fn func(e js.Value)) (remove func()) {
9797// MessageEvent is the type passed to a message handler.
9898type MessageEvent struct {
9999 // string or []byte.
100- Data interface {}
100+ Data any
101101
102102 // There are more fields to the interface but we don't use them.
103103 // See https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
@@ -106,7 +106,7 @@ type MessageEvent struct {
106106// OnMessage registers a function to be called when the WebSocket receives a message.
107107func (c WebSocket ) OnMessage (fn func (m MessageEvent )) (remove func ()) {
108108 return c .addEventListener ("message" , func (e js.Value ) {
109- var data interface {}
109+ var data any
110110
111111 arrayBuffer := e .Get ("data" )
112112 if arrayBuffer .Type () == js .TypeString {
0 commit comments