assets/js/readqr.js   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 1.25

Size

Lines of Code 21
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 5
c 1
b 0
f 0
nc 1
mnd 1
bc 6
fnc 4
dl 0
loc 21
rs 10
bpm 1.5
cpm 1.25
noi 2
1
$(document).on('ready', function () {
2
3
    var scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
0 ignored issues
show
Bug introduced by
The variable Instascan seems to be never declared. If this is a global, consider adding a /** global: Instascan */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
4
    scanner.addListener('scan', function (content) {
5
        $('input[name="ticketId"]').val(content);
6
        $('#qr').hide();
7
        $('button[name="submit"]').click();
8
        scanner.stop();
9
    });
10
    Instascan.Camera.getCameras().then(function (cameras) {
0 ignored issues
show
Bug introduced by
The variable Instascan seems to be never declared. If this is a global, consider adding a /** global: Instascan */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
11
        if (cameras.length > 0) {
12
            scanner.start(cameras[0]);
13
            $('#qr').show();
14
        } else {
15
            console.error('No cameras found.');
16
        }
17
    }).catch(function (e) {
18
        console.error(e);
19
    });
20
21
});