Skip to content
Snippets Groups Projects
Commit c9280e2b authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Convert the ListenOn* funcs to be non-async

parent 219a3da6
No related branches found
No related tags found
1 merge request!109Project/haven beta
......@@ -420,17 +420,12 @@ func (r *RemoteKV) ListenOnRemoteKey(_ js.Value, args []js.Value) any {
localEvents = args[3].Bool()
}
promiseFn := func(resolve, reject func(args ...any) js.Value) {
id, err := r.api.ListenOnRemoteKey(key, version, cb,
localEvents)
if err != nil {
reject(exception.NewTrace(err))
} else {
resolve(id)
}
id, err := r.api.ListenOnRemoteKey(key, version, cb,
localEvents)
if err != nil {
exception.ThrowTrace(err)
}
return utils.CreatePromise(promiseFn)
return id
}
// ListenOnRemoteMap allows the caller to receive updates when the map or map
......@@ -456,17 +451,12 @@ func (r *RemoteKV) ListenOnRemoteMap(_ js.Value, args []js.Value) any {
localEvents = args[3].Bool()
}
promiseFn := func(resolve, reject func(args ...any) js.Value) {
id, err := r.api.ListenOnRemoteMap(mapName, version, cb,
localEvents)
if err != nil {
reject(exception.NewTrace(err))
} else {
resolve(id)
}
id, err := r.api.ListenOnRemoteMap(mapName, version, cb,
localEvents)
if err != nil {
exception.ThrowTrace(err)
}
return utils.CreatePromise(promiseFn)
return id
}
// GetAllRemoteKeyListeners returns a JSON list of { key: [id, id, id, ...] },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment