@@ -19,7 +19,7 @@ import (
19
19
_ "github.com/ncruces/go-sqlite3/driver"
20
20
_ "github.com/ncruces/go-sqlite3/embed"
21
21
vault "github.com/onsonr/motr/app"
22
- "github.com/onsonr/motr/internal /models"
22
+ "github.com/onsonr/motr/pkg /models"
23
23
sink "github.com/onsonr/motr/sink"
24
24
)
25
25
@@ -94,7 +94,7 @@ func serveFetch(handler http.Handler) func() {
94
94
}
95
95
96
96
// Create request handler function
97
- cb := js .FuncOf (func (_ js.Value , args []js.Value ) interface {} {
97
+ cb := js .FuncOf (func (_ js.Value , args []js.Value ) any {
98
98
promise , resolve , reject := newPromiseOptimized ()
99
99
100
100
go handleRequest (h , args [1 ], resolve , reject )
@@ -107,7 +107,7 @@ func serveFetch(handler http.Handler) func() {
107
107
}
108
108
109
109
// handleRequest processes the request with panic recovery
110
- func handleRequest (h http.Handler , jsReq js.Value , resolve , reject func (interface {} )) {
110
+ func handleRequest (h http.Handler , jsReq js.Value , resolve , reject func (any )) {
111
111
defer func () {
112
112
if r := recover (); r != nil {
113
113
var errMsg string
@@ -196,13 +196,13 @@ func (rr *ResponseRecorder) jsResponse() js.Value {
196
196
}
197
197
198
198
// Prepare response init object
199
- init := make (map [string ]interface {} , 3 )
199
+ init := make (map [string ]any , 3 )
200
200
if res .StatusCode != 0 {
201
201
init ["status" ] = res .StatusCode
202
202
}
203
203
204
204
if len (res .Header ) > 0 {
205
- headers := make (map [string ]interface {} , len (res .Header ))
205
+ headers := make (map [string ]any , len (res .Header ))
206
206
for k , v := range res .Header {
207
207
if len (v ) > 0 {
208
208
headers [k ] = v [0 ]
@@ -215,13 +215,13 @@ func (rr *ResponseRecorder) jsResponse() js.Value {
215
215
}
216
216
217
217
// newPromiseOptimized creates a new JavaScript Promise with optimized callback handling
218
- func newPromiseOptimized () (js.Value , func (interface {} ), func (interface {} )) {
218
+ func newPromiseOptimized () (js.Value , func (any ), func (any )) {
219
219
var (
220
- resolve func (interface {} )
221
- reject func (interface {} )
222
- promiseFunc = js .FuncOf (func (_ js.Value , args []js.Value ) interface {} {
223
- resolve = func (v interface {} ) { args [0 ].Invoke (v ) }
224
- reject = func (v interface {} ) { args [1 ].Invoke (v ) }
220
+ resolve func (any )
221
+ reject func (any )
222
+ promiseFunc = js .FuncOf (func (_ js.Value , args []js.Value ) any {
223
+ resolve = func (v any ) { args [0 ].Invoke (v ) }
224
+ reject = func (v any ) { args [1 ].Invoke (v ) }
225
225
return js .Undefined ()
226
226
})
227
227
)
@@ -238,14 +238,14 @@ func awaitPromiseOptimized(promise js.Value) (js.Value, error) {
238
238
err error
239
239
)
240
240
241
- thenFunc := js .FuncOf (func (_ js.Value , args []js.Value ) interface {} {
241
+ thenFunc := js .FuncOf (func (_ js.Value , args []js.Value ) any {
242
242
result = args [0 ]
243
243
close (done )
244
244
return nil
245
245
})
246
246
defer thenFunc .Release ()
247
247
248
- catchFunc := js .FuncOf (func (_ js.Value , args []js.Value ) interface {} {
248
+ catchFunc := js .FuncOf (func (_ js.Value , args []js.Value ) any {
249
249
err = js.Error {Value : args [0 ]}
250
250
close (done )
251
251
return nil
0 commit comments