From 2fb502fb70787ee6dbaf1f616668f5abc3411349 Mon Sep 17 00:00:00 2001 From: DD Liu Date: Thu, 15 Jun 2017 11:53:30 -0400 Subject: [PATCH] add ability to refresh workspace for current editing target --- src/virtual-machine.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 12e6e7a77..90f87f740 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -469,6 +469,17 @@ class VirtualMachine extends EventEmitter { } } + /** + * Repopulate the workspace with the blocks of the current editingTarget. This + * allows us to get around bugs like gui#413. + */ + refreshWorkspace () { + if (this.editingTarget) { + this.emitWorkspaceUpdate(); + this.runtime.setEditingTarget(this.editingTarget); + } + } + /** * Emit metadata about available targets. * An editor UI could use this to display a list of targets and show