mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
d'oh, fix event leak
This commit is contained in:
parent
9f67a74340
commit
43f62ef5d7
1 changed files with 5 additions and 3 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue