@jcbuisson/express-x-client 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/express-x-client.js +2 -1
package/package.json
CHANGED
package/src/express-x-client.js
CHANGED
|
@@ -5,7 +5,6 @@ function expressxClient(socket) {
|
|
|
5
5
|
|
|
6
6
|
const waitingPromises = {}
|
|
7
7
|
const action2service2handlers = {}
|
|
8
|
-
const serviceActions = {}
|
|
9
8
|
|
|
10
9
|
// on connection
|
|
11
10
|
socket.on("connected", async (connectionId) => {
|
|
@@ -64,9 +63,11 @@ function expressxClient(socket) {
|
|
|
64
63
|
serviceHandlers[name] = handler
|
|
65
64
|
},
|
|
66
65
|
}
|
|
66
|
+
// use a proxy to allow for any method name for a service
|
|
67
67
|
const handler = {
|
|
68
68
|
get(service, action) {
|
|
69
69
|
if (!(action in service)) {
|
|
70
|
+
// newly used property: define it as the service method request function
|
|
70
71
|
service[action] = (...args) => serviceMethodRequest(name, action, ...args)
|
|
71
72
|
}
|
|
72
73
|
return service[action]
|