Skip to content
Snippets Groups Projects
Commit 6a83a0b6 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Only emit an event if we get a new code

There is no need to emit the same thing 5 times a second.
parent 272b3ddc
No related branches found
No related tags found
No related merge requests found
......@@ -212,6 +212,7 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
const that = this;
let lastVideoTime = -1;
let lastCode = null;
let lastSentData = null;
function tick() {
that._requestID = null;
......@@ -347,7 +348,9 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
outputMessage.hidden = true;
outputData.parentElement.hidden = false;
outputData.innerText = code.data;
that.sendUrl(code.data);
if (lastSentData !== code.data)
that.sendUrl(code.data);
lastSentData = code.data;
} else {
outputMessage.hidden = false;
outputData.parentElement.hidden = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment