Skip to content

Commit a71cc09

Browse files
Move traceback handling back into jg_debugging
It's under a different event, now, which should be called more often.
1 parent 8db4dd2 commit a71cc09

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/engine/runtime.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,20 +2453,12 @@ class Runtime extends EventEmitter {
24532453
this.threadMap.set(thread.getId(), thread);
24542454
}
24552455

2456-
// pm: Don't append a traceback to monitor threads.
2457-
if (!opts?.updateMonitor) {
2458-
thread.traceback = new Set(opts?.parent_thread?.traceback ?? []).add({
2459-
target: thread.target.id,
2460-
block_id: thread.topBlock
2461-
});
2462-
}
2463-
24642456
// tw: compile new threads. Do not attempt to compile monitor threads.
24652457
if (!(opts && opts.updateMonitor) && this.compilerOptions.enabled) {
24662458
thread.tryCompile();
24672459
}
24682460

2469-
this.emit(Runtime.THREAD_STARTED, thread);
2461+
this.emit(Runtime.THREAD_STARTED, thread, opts);
24702462
return thread;
24712463
}
24722464

src/extensions/jg_debugging/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ class jgDebuggingBlocks {
162162
this.commandSet = {};
163163
this.commandExplanations = {};
164164

165+
runtime.on("THREAD_STARTED", (thread, options) => {
166+
if (options?.updateMonitor) return;
167+
thread.traceback = new Set(options?.parent_thread?.traceback ?? []).add({
168+
target: thread.target.id,
169+
block_id: thread.topBlock,
170+
});
171+
});
172+
165173
this.isScratchBlocksReady = typeof ScratchBlocks === "object";
166174
this.ScratchBlocks = ScratchBlocks;
167175
this.runtime.vm.on("workspaceUpdate", () => {

0 commit comments

Comments
 (0)