diff --git a/extensions/veggiecan/mobilekeyboard.js b/extensions/veggiecan/mobilekeyboard.js index 2ddf765fd6..86f0ec307d 100644 --- a/extensions/veggiecan/mobilekeyboard.js +++ b/extensions/veggiecan/mobilekeyboard.js @@ -19,7 +19,8 @@ class MobileKeyboard { constructor() { this.keyboardOpen = false; - this.waitCallback = null; + /** @type {Array<() => void>} */ + this.waitCallbacks = []; this.defaultValue = ""; this.inputElement = null; } @@ -34,6 +35,10 @@ blockIconURI: blockicon, name: Scratch.translate("Mobile Keyboard"), blocks: [ + { + blockType: Scratch.BlockType.LABEL, + text: Scratch.translate("Currently only works on Android"), + }, { opcode: "showKeyboardBlock", blockType: Scratch.BlockType.COMMAND, @@ -207,10 +212,10 @@ input.parentNode.removeChild(input); } - if (this.waitCallback) { - this.waitCallback(); - this.waitCallback = null; + for (const callback of this.waitCallbacks) { + callback(); } + this.waitCallbacks.length = 0; }; input.addEventListener("input", () => { @@ -236,7 +241,7 @@ showKeyboardAndWaitBlock(args) { return new Promise((resolve) => { - this.waitCallback = resolve; + this.waitCallbacks.push(() => resolve()); this.showKeyboard(args.TYPE); }); }