import { ViewController, React } from './ctr';
const qrcode = require('qrcode/lib/browser');
export default class extends ViewController {
    get _opts() {
        return { errorCorrectionLevel: 'M', margin: 0, ...this.props };
    }
    triggerMounted() {
        if (this.props.text)
            qrcode.toCanvas(this.refs.dom, this.props.text, this._opts);
    }
    triggerUpdate() {
        if (this.props.text)
            qrcode.toCanvas(this.refs.dom, this.props.text, this._opts);
    }
    render() {
        return (React.createElement("canvas", { ref: "dom", style: { display: 'block' } }));
    }
}
