From 76836f6f9d9686f399a4e452c2e614b85c227522 Mon Sep 17 00:00:00 2001 From: Reinhard Budde Date: Thu, 19 Aug 2021 11:48:38 +0200 Subject: [PATCH] issue #1081 - the onWrap function return the result of the wrapped function --- OpenRobertaServer/staticResources/js/helper/wrap.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenRobertaServer/staticResources/js/helper/wrap.js b/OpenRobertaServer/staticResources/js/helper/wrap.js index 160cee4afc..c94275d259 100644 --- a/OpenRobertaServer/staticResources/js/helper/wrap.js +++ b/OpenRobertaServer/staticResources/js/helper/wrap.js @@ -27,11 +27,12 @@ define([ 'exports', 'comm', 'log', 'jquery' ], function(exports, COMM, LOG, $) { var start = new Date(); try { var that = this; - fnToBeWrapped.apply(that,arguments); + var result = fnToBeWrapped.apply(that,arguments); if (message !== undefined) { var elapsed = new Date() - start; LOG.text(elapsed + ' msec: ' + message, '[[TIME]] '); } + return result; } catch (e) { var err = new Error(); var elapsed = new Date() - start; @@ -65,8 +66,9 @@ define([ 'exports', 'comm', 'log', 'jquery' ], function(exports, COMM, LOG, $) { numberOfActiveActions++; var fn = wrapTotal(fnToBeWrapped, message); var that = this; - fn.apply(that,arguments); + var result = fn.apply(that,arguments); numberOfActiveActions--; + return result; } catch (e) { numberOfActiveActions--; var err = new Error();