Sven Seeberg
d90c3eb092
* Use npm to install qrcode npm module * Use Browserify to create wrapped bundle
18 lines
350 B
JavaScript
18 lines
350 B
JavaScript
var QRCode = require('qrcode');
|
|
|
|
class QRCodeWrapper {
|
|
constructor(canvas, inputText) {
|
|
this.canvas = canvas;
|
|
this.inputText = inputText;
|
|
}
|
|
|
|
render() {
|
|
QRCode.toCanvas(this.canvas, this.inputText, function (error) {
|
|
if (error) console.error(error)
|
|
console.log('success!');
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = QRCodeWrapper;
|