mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-03-21 21:00:16 -04:00
Remove debug comments, tweak logic for monitor data merging
This commit is contained in:
parent
13bf932fbb
commit
833c27ef21
1 changed files with 4 additions and 4 deletions
|
@ -1524,8 +1524,9 @@ class Runtime extends EventEmitter {
|
||||||
requestAddMonitor (monitor) {
|
requestAddMonitor (monitor) {
|
||||||
const id = monitor.get('id');
|
const id = monitor.get('id');
|
||||||
if (this._monitorState.has(id)) {
|
if (this._monitorState.has(id)) {
|
||||||
|
// Use mergeWith here to prevent undefined values from overwriting existing ones
|
||||||
this._monitorState = this._monitorState.set(id, this._monitorState.get(id).mergeWith((prev, next) => {
|
this._monitorState = this._monitorState.set(id, this._monitorState.get(id).mergeWith((prev, next) => {
|
||||||
if (!next) {
|
if (typeof next === 'undefined' || next === null) {
|
||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
return next;
|
return next;
|
||||||
|
@ -1546,8 +1547,9 @@ class Runtime extends EventEmitter {
|
||||||
const id = monitor.get('id');
|
const id = monitor.get('id');
|
||||||
if (this._monitorState.has(id)) {
|
if (this._monitorState.has(id)) {
|
||||||
this._monitorState =
|
this._monitorState =
|
||||||
|
// Use mergeWith here to prevent undefined values from overwriting existing ones
|
||||||
this._monitorState.set(id, this._monitorState.get(id).mergeWith((prev, next) => {
|
this._monitorState.set(id, this._monitorState.get(id).mergeWith((prev, next) => {
|
||||||
if (!next) {
|
if (typeof next === 'undefined' || next === null) {
|
||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
return next;
|
return next;
|
||||||
|
@ -1561,8 +1563,6 @@ class Runtime extends EventEmitter {
|
||||||
* @param {!string} monitorId ID of the monitor to remove.
|
* @param {!string} monitorId ID of the monitor to remove.
|
||||||
*/
|
*/
|
||||||
requestRemoveMonitor (monitorId) {
|
requestRemoveMonitor (monitorId) {
|
||||||
// this._monitorState = this._monitorState.delete(monitorId);
|
|
||||||
// TODO is this performant?
|
|
||||||
if (this._monitorState.has(monitorId)) {
|
if (this._monitorState.has(monitorId)) {
|
||||||
this._monitorState = this._monitorState.set(
|
this._monitorState = this._monitorState.set(
|
||||||
monitorId, this._monitorState.get(monitorId).merge({visible: false})
|
monitorId, this._monitorState.get(monitorId).merge({visible: false})
|
||||||
|
|
Loading…
Reference in a new issue