Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 1.3 KB

README.md

File metadata and controls

52 lines (40 loc) · 1.3 KB

Easri QR Code Generator

Cross-browser with HTML5 Canvas, SVG, and Table tag QR Code generator using TypeScript. This repository has no external module dependencies. The development has been initiated by the Vite module bundler.

Build Command

  • Development dependencies install > npm install
  • Run the development > npm run dev
  • Build the project (generate dist folder) > npm run build

Basic Usages

  let app = document.querySelector<HTMLDivElement>("#app");
  if (app !== null) {
    const qrCode = new QRCode(app, "demo text");
  }
  • With some options
  let text = document.querySelector<HTMLInputElement>("#input");
  let app = document.querySelector<HTMLDivElement>("#app");
  if (text === null || text.value === "") return;  

  if (app !== null) {
    const qrCode = new QRCode(app, text.value, {
      width: 128,
      height: 128,
      useSvg: true,
      colorDark: "#0d6efd",
      colorLight: "#ffffff"
    });
  }
  text.value = "";
  • Some methods
qrCode.clear(); // clear the code.
qrCode.makeCode("another text"); // make another code.

Browser Compatibility

IE6~10, Chrome, Firefox, Safari, Opera, Mobile Safari, Android, iOS, etc.

Inspiration Repository

qrcodejs

License

MIT License