refactor: qrcode to ts
This commit is contained in:
1 parent
f3bb8b3602
commit
bac50fc11a
15 files changed
+1316
-3
No files matched your search
+24
@@ -0,0 +1,24 @@
|
||||
import { MODE_8BIT_BYTE } from './QRMode';
|
||||
|
||||
class QR8bitByte {
|
||||
mode: number;
|
||||
data: string;
|
||||
|
||||
constructor(data: string) {
|
||||
this.mode = MODE_8BIT_BYTE;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
getLength(): number {
|
||||
return this.data.length;
|
||||
}
|
||||
|
||||
write(buffer: { put: (arg0: number, arg1: number) => void }): void {
|
||||
for (let i = 0; i < this.data.length; i++) {
|
||||
// not JIS ...
|
||||
buffer.put(this.data.charCodeAt(i), 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default QR8bitByte;
|
||||
Reference in new issue
Block a user