Skip to content

Commit 40f6ccf

Browse files
committed
Add await
1 parent d47c911 commit 40f6ccf

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
```js
4646
module.exports = (srv) => {
4747
srv.on("message", async (req) => {
48-
srv.emit("received", req.data);
48+
await srv.emit("received", req.data);
4949
return req.data.text;
5050
});
5151
};

test/_env/srv/handlers/chat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module.exports = (srv) => {
44
srv.on("message", async (req) => {
5-
srv.emit("received", req.data);
5+
await srv.emit("received", req.data);
66
return req.data.text;
77
});
88
};

test/_env/srv/handlers/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = (srv) => {
2121

2222
srv.on("triggerCustomEvent", async (req) => {
2323
const text = req.data.text + req.data.num;
24-
srv.emit("customEvent", { text });
24+
await srv.emit("customEvent", { text });
2525
return text;
2626
});
2727

test/_env/srv/handlers/odata.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = (srv) => {
44
const { Header } = srv.entities();
55

66
srv.before("CREATE", Header, async (req) => {
7-
srv.emit("received", req.data);
8-
srv.emit("receivedToo", req.data);
7+
await srv.emit("received", req.data);
8+
await srv.emit("receivedToo", req.data);
99
});
1010
};

0 commit comments

Comments
 (0)