Skip to content

Commit 7a7202c

Browse files
authored
Update script.js
updated the sample screenshot URL and comented: // Create a new worker const worker = new Worker('worker.js'); Added: // Robust: resolves worker path relative to this module script const worker = new Worker(new URL('./worker.js', import.meta.url), { type: 'module' });
1 parent b11f190 commit 7a7202c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

script.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ let cropStart = null;
2222
let cropEnd = null;
2323

2424
// Create a new worker
25-
const worker = new Worker('worker.js');
25+
// const worker = new Worker('worker.js');
26+
27+
// Robust: resolves worker path relative to this module script
28+
const worker = new Worker(new URL('./worker.js', import.meta.url), { type: 'module' });
29+
2630

2731
// Listen for messages from the worker
2832
worker.onmessage = function(event) {
@@ -130,7 +134,7 @@ imageInput.addEventListener('change', (e) => {
130134
// Sample screenshot (use a multi-line sample)
131135
sampleBtn.addEventListener('click', () => {
132136
// small sample screenshot (replaceable)
133-
const url = 'https://raw.githubusercontent.com/Xenova/transformers.js/main/assets/invoice.png'; // documents sample
137+
const url = 'https://raw.githubusercontent.com/harisnae/OfflineWebOCR/refs/heads/main/sample_screenshot.png'; // documents sample
134138
imgObj = new Image();
135139
imgObj.crossOrigin = 'anonymous';
136140
imgObj.onload = () => {

0 commit comments

Comments
 (0)