Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where from can I download a pure JS version of this module? #177

Open
ghevge opened this issue Sep 27, 2023 · 4 comments
Open

Where from can I download a pure JS version of this module? #177

ghevge opened this issue Sep 27, 2023 · 4 comments

Comments

@ghevge
Copy link

ghevge commented Sep 27, 2023

Hi,

Where from can I download a pure JS version of this module?

I'm not seeing any dist folder in this repo, not I was able to locate any pege on the internet where from I can download the QR code module for quagga2.

@ericblade/quagga2-reader-qr on npmjs is not available either.

I need a version that will work in a pure javascript app. No react, jquery and/or any other lib dependency of this kind and no TS either.

Thanks

@ghevge
Copy link
Author

ghevge commented Sep 27, 2023

I've converted the index.ts under src into the js code below and imported the jsQR lib (https://github.com/cozmo/jsQR/tree/master/dist) and then I was able to set up the QR reader in quaqa and read qr codes.

Maybe you should publish the JS component too. Not everyon is using TS in their projects.

var QrCodeReader = /** @class */ (function () {
    function QrCodeReader(config, supplements) {
        this._row = [];
        this.config = config || {};
        this.supplements = supplements;
        this.FORMAT = {
            value: 'qr_code',
            writeable: false,
        };
        return this;
    }
    QrCodeReader.prototype.decodeImage = function (inputImageWrapper) {
        var data = inputImageWrapper.getAsRGBA();
        var result = jsQR(data, inputImageWrapper.size.x, inputImageWrapper.size.y);
        if (result === null) {
            return null;
        }
        // TODO: translate result.location into same values as box/boxes from other readers?
        return {
            codeResult: {
                code: result.data,
                format: this.FORMAT.value,
            },
            ...result,
        };
    }
    // eslint-disable-next-line class-methods-use-this,@typescript-eslint/no-unused-vars
    QrCodeReader.prototype.decodePattern = function (pattern) {
        // STUB, this is probably meaningless to QR, but needs to be implemented for Quagga, in case
        // it thinks there's a potential barcode in the image
        return null;
    };
    return QrCodeReader;
}());

In my js app code , i've added:
Quagga.registerReader('qrcode', QrCodeReader);

and in the readers list added: "qrcode"

@ericblade
Copy link
Owner

ericblade commented Oct 26, 2023

hmm. well, yeah, I don't recall that I ever intended this to be anything more than a test case / dev for the external reader package functionality, but.. sure .. It does work as far as I'm aware, so I don't see any reason why not to spend a few minutes putting it together all the way.

I'm going to put this on my todo list to get this in a npm repo by the 29th, let's see if that happens :-) Thanks for your incredible patience with me, my sometimes quite busy life, and continuing to help!

@ericblade
Copy link
Owner

lol ok while cleaning up i just read #54 so yeah, I guess I do need to get that done... ::checks notes:: 3 years later

@ericblade
Copy link
Owner

Had things to deal with over the weekend. Will try to find the time during the week to do this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants