format
Some checks failed
CI / frontend (push) Successful in 1m55s
CI / publish-crates (push) Successful in 23s
CI / rust (push) Successful in 49s
CI / wasm (push) Successful in 1m44s
CI / publish-npm (push) Failing after 1m50s

This commit is contained in:
2026-04-07 01:56:40 +03:00
parent 33f7556b03
commit 5ffc6d866c
42 changed files with 2996 additions and 780 deletions

View File

@@ -121,11 +121,20 @@ export function useLayoutEngine(
// --- Barcode üretimi (WASM üzerinden) ---
let barcodeReqId = 0
const barcodeCallbacks = new Map<number, (result: { width: number; height: number; rgba: ArrayBuffer } | null) => void>()
const barcodeCallbacks = new Map<
number,
(result: { width: number; height: number; rgba: ArrayBuffer } | null) => void
>()
function generateBarcode(format: string, value: string, width: number, height: number, includeText: boolean = false): Promise<{ width: number; height: number; rgba: ArrayBuffer } | null> {
function generateBarcode(
format: string,
value: string,
width: number,
height: number,
includeText: boolean = false,
): Promise<{ width: number; height: number; rgba: ArrayBuffer } | null> {
if (!worker) initWorker()
return new Promise(resolve => {
return new Promise((resolve) => {
barcodeReqId++
const id = barcodeReqId
const timeout = setTimeout(() => {
@@ -140,11 +149,17 @@ export function useLayoutEngine(
})
}
function handleBarcodeResponse(msg: Extract<WorkerResponse, { type: 'barcode-result' } | { type: 'barcode-error' }>) {
function handleBarcodeResponse(
msg: Extract<WorkerResponse, { type: 'barcode-result' } | { type: 'barcode-error' }>,
) {
const cb = barcodeCallbacks.get(msg.id)
if (cb) {
barcodeCallbacks.delete(msg.id)
cb(msg.type === 'barcode-result' ? { width: msg.width, height: msg.height, rgba: msg.rgba } : null)
cb(
msg.type === 'barcode-result'
? { width: msg.width, height: msg.height, rgba: msg.rgba }
: null,
)
}
}