Tweaked TypeScript example code in readme to use more modern const/let instead of var.

pull/118/head
Project Nayuki 3 years ago
parent 6f68c21b1b
commit 11972825b8

@ -69,17 +69,17 @@ TypeScript/JavaScript languages:
```typescript
// Name abbreviated for the sake of these examples here
var QRC = qrcodegen.QrCode;
const QRC = qrcodegen.QrCode;
// Simple operation
var qr0 = QRC.encodeText("Hello, world!", QRC.Ecc.MEDIUM);
var svg = toSvgString(qr0, 4); // See qrcodegen-input-demo
const qr0 = QRC.encodeText("Hello, world!", QRC.Ecc.MEDIUM);
const svg = toSvgString(qr0, 4); // See qrcodegen-input-demo
// Manual operation
var segs = qrcodegen.QrSegment.makeSegments("3141592653589793238462643383");
var qr1 = QRC.encodeSegments(segs, QRC.Ecc.HIGH, 5, 5, 2, false);
for (var y = 0; y < qr1.size; y++) {
for (var x = 0; x < qr1.size; x++) {
const segs = qrcodegen.QrSegment.makeSegments("3141592653589793238462643383");
const qr1 = QRC.encodeSegments(segs, QRC.Ecc.HIGH, 5, 5, 2, false);
for (let y = 0; y < qr1.size; y++) {
for (let x = 0; x < qr1.size; x++) {
(... paint qr1.getModule(x, y) ...)
}
}

Loading…
Cancel
Save