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;
|