Giter Site home page Giter Site logo

neocotic / qrious Goto Github PK

View Code? Open in Web Editor NEW
1.5K 35.0 216.0 1.41 MB

Pure JavaScript library for QR code generation using canvas

Home Page: https://neocotic.com/qrious

License: Other

JavaScript 54.22% HTML 45.78%
qr qrcode qrcode-generator javascript browser

qrious's Introduction

 .d88888b.  8888888b.  d8b
d88P" "Y88b 888   Y88b Y8P
888     888 888    888
888     888 888   d88P 888  .d88b.  888  888 .d8888b
888     888 8888888P"  888 d88""88b 888  888 88K
888 Y8b 888 888 T88b   888 888  888 888  888 "Y8888b.
Y88b.Y8b88P 888  T88b  888 Y88..88P Y88b 888      X88
 "Y888888"  888   T88b 888  "Y88P"   "Y88888  88888P'
       Y8b

QRious is a pure JavaScript library for generating QR codes using HTML5 canvas.

Chat Demo Dev Dependency Status License Release

Install

Install using the package manager for your desired environment(s):

$ npm install --save qrious
# OR:
$ bower install --save qrious

If you want to simply download the file to be used in the browser you can find them below:

Check out node-qrious if you want to install it for use within Node.js.

Examples

<!DOCTYPE html>
<html>
  <body>
    <canvas id="qr"></canvas>

    <script src="/path/to/qrious.js"></script>
    <script>
      (function() {
        var qr = new QRious({
          element: document.getElementById('qr'),
          value: 'https://github.com/neocotic/qrious'
        });
      })();
    </script>
  </body>
</html>

Open up demo.html in your browser to play around a bit.

API

Simply create an instance of QRious and you've done most of the work. You can control many aspects of the QR code using the following fields on your instance:

Field Type Description Default Read Only
background String Background color of the QR code "white" No
backgroundAlpha Number Background alpha of the QR code 1.0 No
element Element Element to render the QR code <canvas> Yes
foreground String Foreground color of the QR code "black" No
foregroundAlpha Number Foreground alpha of the QR code 1.0 No
level String Error correction level of the QR code (L, M, Q, H) "L" No
mime String MIME type used to render the image for the QR code "image/png" No
padding Number Padding for the QR code (pixels) null (auto) No
size Number Size of the QR code (pixels) 100 No
value String Value encoded within the QR code "" No
var qr = new QRious();
qr.background = 'green';
qr.backgroundAlpha = 0.8;
qr.foreground = 'blue';
qr.foregroundAlpha = 0.8;
qr.level = 'H';
qr.padding = 25;
qr.size = 500;
qr.value = 'https://github.com/neocotic/qrious';

The QR code will automatically update when you change one of these fields, so be wary when you plan on changing lots of fields at the same time. You probably want to make a single call to set(options) instead as it will only update the QR code once:

var qr = new QRious();
qr.set({
  background: 'green',
  backgroundAlpha: 0.8,
  foreground: 'blue',
  foregroundAlpha: 0.8,
  level: 'H',
  padding: 25,
  size: 500,
  value: 'https://github.com/neocotic/qrious'
});

These can also be passed as options to the constructor itself:

var qr = new QRious({
  background: 'green',
  backgroundAlpha: 0.8,
  foreground: 'blue',
  foregroundAlpha: 0.8,
  level: 'H',
  padding: 25,
  size: 500,
  value: 'https://github.com/neocotic/qrious'
});

You can also pass in an element option to the constructor which can be used to generate the QR code using an existing DOM element, which is the only time that you can specify read only options. element must either be a <canvas> element or an <img> element which can then be accessed via the canvas or image fields on the instance respectively. An element will be created for whichever one isn't provided or for both if no element is specified, which means that they can be appended to the document at a later time.

var qr = new QRious({
  element: document.querySelector('canvas'),
  value: 'https://github.com/neocotic/qrious'
});

qr.canvas.parentNode.appendChild(qr.image);

A reference to the QRious instance is also stored on both of the elements for convenience.

var canvas = document.querySelector('canvas');
var qr = new QRious({
  element: canvas,
  value: 'https://github.com/neocotic/qrious'
});

qr === canvas.qrious;
//=> true

toDataURL([mime])

Generates a base64 encoded data URI for the QR code. If you don't specify a MIME type, it will default to the one passed to the constructor as an option or the default value for the mime option.

var qr = new QRious({
  value: 'https://github.com/neocotic/qrious'
});

qr.toDataURL();
//=> "data:image/png;base64,iVBOR...AIpqDnseH86KAAAAAElFTkSuQmCC"
qr.toDataURL('image/jpeg');
//=> "data:image/jpeg;base64,/9j/...xqAqIqgKFAAAAAq3RRQAUUUUAf/Z"

Migrating from older versions

If you've been using an older major version and would like details on what's changed and information on how to migrate to the latest major release below:

https://github.com/neocotic/qrious/wiki/Migrating-from-older-versions

Bugs

If you have any problems with QRious or would like to see changes currently in development you can do so here. Core features and issues are maintained separately here.

Contributors

If you want to contribute, you're a legend! Information on how you can do so can be found in CONTRIBUTING.md. We want your suggestions and pull requests!

A list of QRious contributors can be found in AUTHORS.md.

License

Copyright © 2017 Alasdair Mercer
Copyright © 2010 Tom Zerucha

See LICENSE.md for more information on our GPLv3 license.

qrious's People

Contributors

alasdairmercerswrx avatar anthonyryan1 avatar mjmasn avatar neocotic avatar throrin19 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qrious's Issues

Drop support for Node.js < 4

The current build contains unnecessary complexity as it tries to support Node.js 0.10 and 0.12 to some degree. I'd like to drop that support and simplify our build and contributor guidelines in the progress.

Center the Code?

Is there a way to center the code in the canvas? There seems to be some space on one side making it not centered on the page.

Consider using double license GPL/MIT

I'd like to use your library for a professional project. GPL license is not an option, therefore I cannot use it. Any reason why you didn't choose the MIT licence?

zxing cannot detect QR code?

The QR codes by this library appear not to be able to be read by zxing-based QR code readers:

Please try the below code which simply contains the data "hello".

qr-code-hello

Remove padding

If I set padding to 0 the qr code acts generates an image with white space to the right, this happens by generating a dataurl directly without a element. The

I am Just trying to remove padding completely.

Great work btw it's quite fast compared to other ones I have used.

Implementing with angular.js

Is there a way to implement this plugin with angular.js? Like manipulating the color, size, level etc in real time? like this plugin https://github.com/monospaced/angular-qrcode

I tried to use the above plugin but the problem is I can't download it in my device, im developing using Ionic+Cordova Framework. This plugin worked for me because it can be saved as canvas then convert into image, the problem is I can't manipulate it's settings in real time like the monospaced plugin.

I am new to Angular.js and I have no idea how to do this. :(

Enhancement : Add borders to produced QR codes pictures

Some printing solution (kiosk / thermal printers like Micronics) doesn't allow to add border styles to pictures.
The result is that the printed QR code is always left aligned.
The only solution was to add "leftBorder" and "topBorder" settings.

Usage :
var qr_data = qr.toDataURL({ value: 'my value', size: 7, leftBorder: 160 // in pixels })

I modified the function canvas() to achieve this.

canvas: function(data) {
      data = normalizeData(data);

      // Module size of the generated QR code (i.e. 1-10).
      var size = data.size >= 1 && data.size <= 10 ? data.size : 4;
      // Actual size of the QR code symbol and is scaled to 25 pixels (e.g. 1 = 25px, 3 = 75px).
      size *= 25;

      // Partikule hack : Add border
      var leftBorder = data.leftBorder > 0 ? data.leftBorder : 0;
      var topBorder = data.topBorder > 0 ? data.topBorder : 0;
      var cwidth = size + leftBorder;
      var cHeight = size + topBorder;

      // `<canvas>` element used to render the QR code.
      var cvs = data.canvas || createCanvas();
      // Retreive the 2D context of the canvas.
      var c2d = cvs.getContext('2d');
      // Ensure the canvas has the correct dimensions.
      c2d.canvas.width  = cwidth;
      c2d.canvas.height = cHeight;
      // Fill the canvas with the correct background colour.
      c2d.fillStyle = data.background || '#fff';
      c2d.fillRect(0, 0, cwidth, cHeight);

      // Determine the ECC level to be applied.
      eccLevel = ECC_LEVELS[(data.level && data.level.toUpperCase()) || 'L'];

      // Generate the image frame for the given `value`.
      var frame = generateFrame(data.value || '');

      c2d.lineWidth = 1;

      // Determine the *pixel* size.
      var px = size;
      px /= width;
      px  = Math.floor(px);

      var offset = Math.floor((size - (px * width)) / 2);

      // Draw the QR code.
      c2d.clearRect(0, 0, cwidth, cHeight);
      c2d.fillStyle = data.background || '#fff';
      c2d.fillRect(0, 0, cwidth, cHeight);
      c2d.fillStyle = data.foreground || '#000';

      var i, j;

      for (i = 0; i < width; i++) {
        for (j = 0; j < width; j++) {
          if (frame[j * width + i]) {
            c2d.fillRect(px * i + offset + leftBorder, px * j + offset + topBorder, px, px);
          }
        }
      }

      return cvs;
    },

Reduce size of distribution files

Since we're using Babel to compile our ES6-based source code into JavaScript that's supported everywhere our distribution files contained quite a few Babel helpers to achieve this. However, in order to fix #55, we were required to include babel-runtime in our distribution files as well since, as a library, we can't really rely on external polyfills so this includes all those that are needed to run on older browser versions.

Unfortunately, this has resulted in a significant increase to the size of our distribution files:

Format Minified Size in 2.0.2 (KB) Size in 2.1.0 (KB) Increase (%)
CJS No 60.7 109 79.6
UMD No 64 111 73.4
UMD Yes 20.6 35.8 73.8

I'm not really happy that, in order to use Babel to compile my library, we have to include so much Babel code in our own distribution files. We're using Rollup so that should be reducing exactly what's included to only what's being used. If this is the cost of using Babel in a library, then I'm open to going back to ES5 source code and only using Rollup for bundling. I've already started doing this with other libraries that I manage to avoid this distribution size increase.

I'll try to have a look to see what other libraries are doing out there that use Babel+Rollup to compile their code. If it comes down to browser/Node.js feature support, I might just have to track down what we're using that needs polyfilled and try to replace these individually. However, until we get some form of unit tests and automated cross-browser testing in place (which I'm struggling to find the time/energy to do), this could be a very long process.

What I'd like to understand is what options are available to us.

undefined symbol: node_module_register

I'm not sure how this relates to PM2, but if I run my app without it, it works fine. Otherwise I get this error:

Error: /opt/myproject/node_modules/qr-js/node_modules/canvas/build/Release/canvas.node: undefined symbol: node_module_register
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.<anonymous> (/usr/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
    at Function.cls_wrapMethod [as _load] (/opt/myproject/node_modules/newrelic/lib/shimmer.js:230:38)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/opt/myproject/node_modules/qr-js/node_modules/canvas/lib/bindings.js:2:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.<anonymous> (/usr/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
    at Function.cls_wrapMethod [as _load] (/opt/myproject/node_modules/newrelic/lib/shimmer.js:230:38)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    ...

Node v0.12.7 and NPM 2.11.3

Possibly related to pm2 project via Unitech/pm2#1518.

Clarification on license (GPL code becomes MIT-licensed?)

I see qr.js is licensed under the MIT license.
The license section at the top of the qr.js file mentions that qr.js is based on jsqrencode, which is GPL-licensed:

// [qr.js](http://neocotic.com/qr.js)  
// (c) 2014 Alasdair Mercer  
// Freely distributable under the MIT license.  
// Based on [jsqrencode](http://code.google.com/p/jsqrencode/)  
// (c) 2010 [email protected]  
// Licensed under the GPL Version 3 license.  
// For all details and documentation:  
// <http://neocotic.com/qr.js>

Part of the GPL license is that derivatives must be licensed under the same license. Extract from section 5:

c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. [...] This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.

Question: have you received permission from upstream jsqrencode to change the licence from GPL to MIT?

Is there any non ascii support?

I have use Qrious like qrious.value='Greeting from **' but when I scanned it, there only the 'Greeting from ' left, the non-ascii charactor is lost.

Is there a way to keep the non-ascii?

Enable setting of multiple properties at once resulting in a single re-render

Add a set method to allow multiple properties to be set at once, but with a single re-render. Given the following example:

const qr = new QRious({
  element: document.querySelector('canvas'),
  value: 'https://github.com/neocotic/qrious'
})

If you wanted to change the colours and value, QRious would re-render the QR code 3 times:

qr.background = '#ff0000'
qr.foreground = '#0000ff'
qr.value = 'QRious'

However, with this proposed change, these properties could be changed in a single call and result in a single re-render:

qr.set({
  background: '#ff0000',
  foreground: '#0000ff',
  value: 'QRious'
})

This should also be documented as well though while also explicitly mentioning that the QR code is re-rendered each time a property is changed.

API additions

Add a VERSION property which indicates the current version of the library as well as a new toDataURL method which takes the same arguments as canvas and image except for their own configuration properties (e.g. data.canvas). Also, a noConflict method will be good.
#7 should also apply to any new methods, where applicable.

Improve download links in README

The download links in the README.md file should also have file size information as well as download links for their corresponding source map files.

All links should be using RawGit production (CDN) URLs to avoid developers having issues with load times, MIME types etc.

WebGL support

Hi,

I'm trying to use this with PIXI.js for a game. PIXI.js uses webGl whenever available.The canvas is first created by PIXI. It seems this library fails if the canvas is using webgl.

Can anyone suggest me a solution using this library?

Reformat code

Reformat the code to adhere to latest JavaScript coding standards and change code documentation to work with docco. While I'm at it I should probably add some more comments (or at least re-add tz's original comments).

require js incompatible

line 1008:

define('qr', function Z() {

      return qr;
    });

should be

define(function Z() {

      return qr;
    });

npm registry still lists node-canvas as dependency

It has been noted by @justin-lau on #28 that, although the package.json file in master only declares node-canvas under optionalDependencies, the npm registry appears to have it listed under optionalDependencies and dependencies:

qrious (master) λ npm view [email protected] dependencies
{ canvas: '^1.3.12' }
qrious (master) λ npm view [email protected] optionalDependencies
{ canvas: '^1.3.12' }

This is very odd and I'm not sure why it's doing that. I think the first, and possibly easiest, attempt to fit it would be to simply attempt a bump of the fix version to 2.2.1. This should hopefully give npm the nudge it needs (for some reason). If that doesn't fix it, I'll have to reach out to npm for further assistance.

QR code is not centered

I'm using qr.js within a polymer element and this happens:
canvas

I've inverted the colors to see the problem better on white background.

Transparent background?

Is it possible to have a transparent background? I tried

const qr = new QRious({
  element: ...,
  foreground: '#1a1a1a',
  background: 'transparent',  // also tried null and undefined
  value: 'https://github.com/neocotic/qrious',
  size: 500
});

but it doesn't work.

Doesn't generate valid QR codes?

Hi,

I'm using version 1.1.4 with the example code to generate "Hello". It makes this QR code:

hello

I tried scanning it with Android's Barcode Scanner app but it doesn't seem to be a valid QR code. I can't see that I'm doing anything wrong...

node-canvas dependency breaks browserify

I am trying to use this library in a browserify project, which won't need node-canvas.

Is there any way the node-canvas dependency be changed so that it is not required when npm installing?

Maybe using optionalDependencies in package.json?

Can't install properly, dependency is triggering error

The full stack error npm gives is below:

user@machine:~/Projects/some-project$ npm install qr-js --save
-
> [email protected] install /home/user/Projects/some-project/node_modules/qr-js/node_modules/canvas
> node-gyp rebuild

Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
gyp: Call to './util/has_cairo_freetype.sh' returned exit status 0. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 3.13.0-62-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/user/Projects/some-project/node_modules/qr-js/node_modules/canvas
gyp ERR! node -v v0.10.37
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok 

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the canvas package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls canvas
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-62-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "qr-js" "--save"
npm ERR! cwd /home/user/Projects/some-project
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

Thanks

Padding issues

The whitespace padding needs to be much more consistent as it currently varies depending on the size and doesn't fill the dimensions well enough.

Split into multiple modules

In order to make QRious easier for developers to install and to simplify the node-canvas dependency which is only required when running on Node.js.

I'm currently planning on splitting the code base into the following modules:

  • qrious-core
    • The logic shared by both qrious-node and qrious
    • Should not contain any environment-specific code (e.g. browser, Node.js)
  • qrious-node
    • The Node.js version of QRious
  • qrious
    • The browser version of QRious

The modules would be contained within the same Git repository to simplify development of cross-module dependencies as well as releases.

Ideally, developers should be able to build all modules from the repository root as well as build individual modules from within their directory. Shared configurations and documentation should be contained within the repository root to avoid too much duplication.

webpack issue with canvas

Hey there,
Thank you for your efforts on the new version 2.0.1 !
Do you have a working example of using webpack?
I tried to use npm install --no-optional
but I still get an error when running webpack
ERROR in ./~/qrious/dist/cjs/qrious.js Module not found: Error: Cannot resolve module 'canvas' in my/path/to/node_modules/qrious/dist/cjs @ ./~/qrious/dist/cjs/qrious.js 23:13-30


Did you encounter the same issue before?

Thanks!
& have a great day,
Emmanuel

Error trying to install - not going to bother troubleshooting

Just thought you might like to know:

vagrant@homestead:~/Code/app-gateway$ npm install qr-js --save
npm WARN install Couldn't install optional dependency: Unsupported

[email protected] install /home/vagrant/Code/app-gateway/node_modules/canvas
node-gyp rebuild

./util/has_cairo_freetype.sh: 4: ./util/has_cairo_freetype.sh: pkg-config: not found
gyp: Call to './util/has_cairo_freetype.sh' returned exit status 0. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:355:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.19.0-25-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/vagrant/Code/app-gateway/node_modules/canvas
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Linux 3.19.0-25-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "qr-js" "--save"
npm ERR! node v5.0.0
npm ERR! npm v3.3.6
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the canvas package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls canvas
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/vagrant/Code/app-gateway/npm-debug.log

Fresh install attempted in vagrant vm with new node/npm.

I liked your documentation and custom website, but qr-image worked on first pass and I'll see how that goes...

"Error: undefined is not a function"

Love QR.js, thank you for building it. I had it working in the browser but it has broken for some reason I'm having troubles isolating why. Here is the error I am being thrown:

"TypeError: undefined is not a function
at Object.X.canvas (http://localhost:8080/app/lib/qr.min.js:4:10052)
at Object.X.toDataURL (http://localhost:8080/app/lib/qr.min.js:4:10868)
at http://localhost:8080/app/admin/admin.js:212:26
(etc.)"

Here is my code:
212 var base64 = qr.toDataURL({
213 mime: 'image/png',
214 value: vip.email,
215 size: 10,
216 level: H
217 }, function(err) {
218 if (err) throw err;
219 console.log(error);
220 });

Any thoughts?

Improve API

I've realised that my naming choices for the API probably wasn't the best it could have been as generateCanvas and generateImage are quite long and since these functions may be generating a QR Code on an existing <canvas> or <img> element it can be quite misleading.

For these reasons I'm considering renaming the functions to simply QRCode.canvas and QRCode.image. I'll only deprecate the existing functions for now as to provide backwards compatibility and I will possibly remove them in a future release.

Change code style to be more contributor-friendly

While I still like having no semi-colons as it's helped me learn more about ASI, I have found it off-putting to contributors as those more unfamiliar with ASI can find it daunting.

I'm going to switch from eslint-config-skelp to eslint-config-notninja for my alternative, beginner-friendly, linting configuration.

NodeJS and CommonJS support

Add support for these frameworks using the same method as my other libraries for callback method implementation. Dependencies should be added for the canvas module.

Deferring or avoiding ImageRenderer

I recently upgraded from an older version of this (qr.js) and noticed that the new version generated a Content Security Policy warning the website where I deployed it. The website doesn't allow data URIs under any circumstances and the ImageRenderer creates an image tag and populates it with a data URL as part of the constructor now.

One solution might be to not render the image until a method call requesting it has been made.

Canvas/image single argument

Add support to canvas and image methods for a single object or string argument. Where a string is specified the method treats it as the value and all configurations use their default values.

Not working with react-native?

I tried line bellow in my react native project:

  const qr = new QRious({ value: mac });

and got following error:

2016-08-08 01:03:26.975 [error][tid:com.facebook.react.JavaScript] Can't find variable: document 2016-08-08 01:03:26.991 [fatal][tid:com.facebook.react.RCTExceptionsManagerQueue] Unhandled JS Exception: Can't find variable: document

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.