diff --git a/src/engine/runtime.js b/src/engine/runtime.js index e8b9c52d..d8956586 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -409,6 +409,8 @@ class Runtime extends EventEmitter { warpTimer: false }; + this.debug = false; + this._animationFrame = this._animationFrame.bind(this); this._animationFrameId = null; this._lastStepTime = Date.now(); @@ -2387,6 +2389,11 @@ class Runtime extends EventEmitter { }); } + enableDebug () { + this.resetAllCaches(); + this.debug = true; + } + /** * Emit glows/glow clears for scripts after a single tick. * Looks at `this.threads` and notices which have turned on/off new glows. diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 89708d55..f97b2b00 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -252,6 +252,10 @@ class VirtualMachine extends EventEmitter { this.runtime.setCompilerOptions(compilerOptions); } + enableDebug () { + this.runtime.enableDebug(); + } + /** * Stop all threads and running activities. */