Skip to content

Commit b75a4f6

Browse files
Don't mutate the actual state object. (#49)
Fixes #45
1 parent 48f6ca4 commit b75a4f6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/demo.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ <h1>MicroPython-micro:bit simulator example embedding</h1>
9292
<option value="pin_logo">Pin logo</option>
9393
<option value="radio">Radio</option>
9494
<option value="sensors">Sensors</option>
95-
<option value="sound_effects_builtin">Sound effects (builtin)</option>
95+
<option value="sound_effects_builtin">
96+
Sound effects (builtin)
97+
</option>
9698
<option value="sound_effects_user">Sound effects (user)</option>
9799
<option value="speech">Speech</option>
98100
<option value="volume">Volume</option>
@@ -319,9 +321,10 @@ <h1>MicroPython-micro:bit simulator example embedding</h1>
319321
const labelElt = document.createElement("label");
320322
const text = labelElt.appendChild(document.createElement("span"));
321323
text.innerText = info.type;
322-
delete info.type;
323324
const infoText = labelElt.appendChild(document.createElement("code"));
324-
infoText.innerText = JSON.stringify(info);
325+
const infoMutable = { ...info };
326+
delete infoMutable.type;
327+
infoText.innerText = JSON.stringify(infoMutable);
325328
return labelElt;
326329
};
327330

0 commit comments

Comments
 (0)