- fix test livedata stub - methods calling methods

This commit is contained in:
denihs
2023-01-26 14:38:25 -04:00
parent fa6d0c1d71
commit f8334b8a42
2 changed files with 7 additions and 8 deletions

View File

@@ -1741,8 +1741,6 @@ export class Connection {
}
async onMessage(raw_msg) {
//TODO[fibers]: remove comment
console.log('onMessage', raw_msg);
let msg;
try {
msg = DDPCommon.parseDDP(raw_msg);

View File

@@ -678,18 +678,19 @@ if (Meteor.isClient) {
// setup methods
conn.methods({
do_something: function() {
conn.call('do_something_else');
do_something: async function() {
await conn.applyAsync('do_something_else', []);
},
do_something_else: function() {
coll.insertAsync({ a: 1 });
do_something_else: async function() {
await coll.insertAsync({ a: 1 });
}
});
const o = await observeCursor(test, coll.find());
// call method.
conn.call('do_something', _.identity);
// we use the applyAsync() instead of callAsync() because we want to control when to "pause"
// or "continue" the method execution by using the methods stream.receive()
await conn.applyAsync('do_something', []);
// see we only send message for outer methods
const message = testGotMessage(test, stream, {