d'oh, fix event leak

This commit is contained in:
Vivianne Langdon 2022-02-27 00:18:38 -08:00
parent 9f67a74340
commit 43f62ef5d7

View file

@ -644,9 +644,11 @@ let BookWyrm = new (class {
const statusNode = document.getElementById("barcode-status");
const cameraListNode = document.getElementById("barcode-camera-list");
let changeListener = cameraListNode.addEventListener('change', (event) => {
cameraListNode.addEventListener('change', onChangeCamera);
function onChangeCamera(event) {
initBarcodes(event.target.value);
});
}
function toggleStatus(status) {
for (const child of statusNode.children) {
@ -724,7 +726,7 @@ let BookWyrm = new (class {
function cleanup(clearDrawing = true) {
Quagga.stop();
cameraListNode.removeEventListener('change', changeListener);
cameraListNode.removeEventListener('change', onChangeCamera);
if (clearDrawing) {
scannerNode.replaceChildren();