From 7a6ca45905db37c837adf97f012a61ea972c6bb1 Mon Sep 17 00:00:00 2001 From: Maya Rajan Date: Sun, 23 Mar 2025 14:59:58 -0400 Subject: [PATCH 1/5] update webpack --- scratch-packages/scratch-gui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scratch-packages/scratch-gui b/scratch-packages/scratch-gui index 91c188acf..897079762 160000 --- a/scratch-packages/scratch-gui +++ b/scratch-packages/scratch-gui @@ -1 +1 @@ -Subproject commit 91c188acf6f2f1a9e267c8a5a61e196fb18bcc39 +Subproject commit 897079762038fffd985aa6b28878b07ce8f5fafb From 332ac9ad04864a2c0cc03db81a976b7047651f00 Mon Sep 17 00:00:00 2001 From: Maya Rajan Date: Wed, 2 Apr 2025 23:41:48 -0400 Subject: [PATCH 2/5] update gui --- scratch-packages/scratch-gui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scratch-packages/scratch-gui b/scratch-packages/scratch-gui index 897079762..51cde1718 160000 --- a/scratch-packages/scratch-gui +++ b/scratch-packages/scratch-gui @@ -1 +1 @@ -Subproject commit 897079762038fffd985aa6b28878b07ce8f5fafb +Subproject commit 51cde17188b5242c8cbb2013702b8308efca3f93 From 4ab0356d8aa5602aebfabe271500d78b822cd127 Mon Sep 17 00:00:00 2001 From: Maya Rajan Date: Thu, 22 May 2025 00:05:27 -0400 Subject: [PATCH 3/5] update submodules --- scratch-packages/scratch-gui | 2 +- scratch-packages/scratch-vm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scratch-packages/scratch-gui b/scratch-packages/scratch-gui index 51cde1718..638e31019 160000 --- a/scratch-packages/scratch-gui +++ b/scratch-packages/scratch-gui @@ -1 +1 @@ -Subproject commit 51cde17188b5242c8cbb2013702b8308efca3f93 +Subproject commit 638e31019590c369b51badc2b0a8c07dfe52782b diff --git a/scratch-packages/scratch-vm b/scratch-packages/scratch-vm index 8aca21fd7..b7786b45e 160000 --- a/scratch-packages/scratch-vm +++ b/scratch-packages/scratch-vm @@ -1 +1 @@ -Subproject commit 8aca21fd7b82334d39c804f89d02096121242551 +Subproject commit b7786b45eb42735aeef024d496e40903457b7486 From 60dbf54fce8c32c86be135a287adc71b4b4621b7 Mon Sep 17 00:00:00 2001 From: Maya Rajan Date: Mon, 2 Jun 2025 15:34:11 -0400 Subject: [PATCH 4/5] check context --- extensions/src/common/utils.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/extensions/src/common/utils.ts b/extensions/src/common/utils.ts index 61ac1f9f3..45728c662 100644 --- a/extensions/src/common/utils.ts +++ b/extensions/src/common/utils.ts @@ -1,4 +1,4 @@ -import { MenuItem, Primitive, RGBObject } from "./types" +import { MenuItem, Primitive, RGBObject, BlockUtilityWithID } from "./types"; type FetchParams = { request: Parameters[0], @@ -303,3 +303,14 @@ export const uuidv4 = () => 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); + +export const checkContext = (blockInstance: BlockUtilityWithID, target: string) => { + const topBlock = blockInstance.thread.topBlock; + const blocks = blockInstance.thread.blockContainer._blocks; + const topOpcode = blocks[topBlock].opcode; + const methodName = topOpcode.split("_")[1]; + if (methodName == target) { + return true; + } + return false; +} From bae366e7cb1ea33fed7f37a0c267ef179fe13474 Mon Sep 17 00:00:00 2001 From: Maya Rajan Date: Mon, 2 Jun 2025 15:34:40 -0400 Subject: [PATCH 5/5] context test --- extensions/src/simple_example/index.ts | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/extensions/src/simple_example/index.ts b/extensions/src/simple_example/index.ts index 932207f4b..491335c87 100644 --- a/extensions/src/simple_example/index.ts +++ b/extensions/src/simple_example/index.ts @@ -85,10 +85,30 @@ export default class SimpleTypescript extends extension(details, "ui", "customSa imageBlock(jibo: "inline image") { } + @(scratch.command`Test hat 2`) + testing() { + this.value = 5; + } + @(scratch.reporter`${{ type: "number", defaultValue: 1 }} + ${{ type: "image", uri: five, alt: "golden five" }} - ${"number"}`) - addFive(lhs: number, five: "inline image", rhs: number, { blockID }: BlockUtilityWithID) { - console.log(blockID); + addFive(lhs: number, five: "inline image", rhs: number, blockInstance: BlockUtilityWithID) { + console.log(blockInstance); + console.log(blockInstance.blockID); + setTimeout(() => { + console.log(blockInstance.blockID); + }, 500) + // topBlock return lhs + 5 - rhs; } + + @(scratch.hat`Test hat`) + testHat() { + return this.value == 5; + } + + @(scratch.event`Test`) + testEvent() { + return this.value == 5; + } }