You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

QR code reader javascript

Received Response
55
Views
5
Comments
edited Sep 15, 2018 2:39AM in Visual Builder 5 comments

Content

Hi,

I'm trying to user qr code reader Javascript and imported as a resource. However, i get the "qrcode is not defined" error, am I declaring the Javascript incorrectly (see code snippet)?

Please advise, thank you

Code Snippet

define(["mobileApps/test1/resources/qrcode.js"], function(qrcode) {
  'use strict';

  var PageModule = function PageModule() {};

  return PageModule;
  
});



function openQRCamera(node) {
  var reader = new FileReader();
  reader.onload = function() {
    node.value = "";
    qrcode.callback = function(res) {
      if(res instanceof Error) {
        alert("No QR code found. Please make sure the QR code is within the camera's frame and try again.");
      } else {
        node.parentNode.previousElementSibling.value = res;
    
Tagged:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!