From f2253fe6199bb8d20dc27b99dc58f2ca104d9ed9 Mon Sep 17 00:00:00 2001 From: Gabriel Grubba Date: Tue, 7 Mar 2023 15:18:46 -0300 Subject: [PATCH] feat: isAsyncCall --- packages/ddp-client/common/livedata_connection.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/ddp-client/common/livedata_connection.js b/packages/ddp-client/common/livedata_connection.js index 64726d7d7e..19e2f2680b 100644 --- a/packages/ddp-client/common/livedata_connection.js +++ b/packages/ddp-client/common/livedata_connection.js @@ -511,6 +511,17 @@ export class Connection { return handle; } + /** + * @summary Tells if the method call came from a call or a callAsync. + * @alias Meteor.isAsyncCall + * @locus Anywhere + * @memberOf Meteor + * @importFromPackage meteor + * @returns boolean + */ + isAsyncCall(){ + return DDP._CurrentMethodInvocation._isCallAsyncMethodRunning() + } methods(methods) { Object.entries(methods).forEach(([name, func]) => { if (typeof func !== 'function') { @@ -722,7 +733,6 @@ export class Connection { _apply(name, stubCallValue, args, options, callback) { const self = this; - // We were passed 3 arguments. They may be either (name, args, options) // or (name, args, callback) if (!callback && typeof options === 'function') {