Constructors

Accessors

  • get size(): undefined | { width: number; height: number }
  • Returns undefined | { width: number; height: number }

Methods

  • Parameters

    • Optionalcontainer: HTMLElement

      This container will be used for appending of the QR code

    Returns void

  • Parameters

    • extension: ExtensionFunction

      Extension is a function that takes svg and previously applied options and modifies an svg

    Returns void

    const extension = (svg, options) => {
    const { width, height } = options;
    const size = Math.min(width, height);
    const border = options.document.createElementNS("http://www.w3.org/2000/svg", "rect");
    const borderAttributes = {
    fill: "none",
    x: (width - size + 40) / 2,
    y: (height - size + 40) / 2,
    width: size - 40,
    height: size - 40,
    stroke: "black",
    "stroke-width": 40,
    rx: 100
    };
    Object.keys(borderAttributes).forEach((attribute) => {
    border.setAttribute(attribute, borderAttributes[attribute]);
    });
    svg.appendChild(border);
    };