From d3d3cfe6e3cd0bddac32b87ea6e90cc5ec8d319a Mon Sep 17 00:00:00 2001 From: Muffin Date: Wed, 26 Jul 2023 20:39:23 -0500 Subject: [PATCH] Allow controlling addon block return shape --- src/engine/runtime.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/engine/runtime.js b/src/engine/runtime.js index 6d871eeb..14bb2110 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -2588,7 +2588,8 @@ class Runtime extends EventEmitter { * @param {string} options.procedureCode The ID of the block * @param {function} options.callback The callback, called with (args, BlockUtility). May return a promise. * @param {string[]} [options.arguments] Names of the arguments accepted. Optional if no arguments. - * @param {boolean} [hidden] True to not include this block in the block palette + * @param {boolean} [options.hidden] True to not include this block in the block palette + * @param {1|2} [options.return] 1 for round reporter, 2 for boolean reported, leave empty for statement. */ addAddonBlock (options) { const procedureCode = options.procedureCode; @@ -2633,6 +2634,7 @@ class Runtime extends EventEmitter { ` argumentnames="${xmlEscape(JSON.stringify(names))}"` + ` argumentids="${xmlEscape(JSON.stringify(ids))}"` + ` argumentdefaults="${xmlEscape(JSON.stringify(defaults))}"` + + `${options.return ? ` return="${xmlEscape(options.return.toString())}"` : ''}` + '>' }); }