Skip to content

Commit

Permalink
feature: use module worker (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
levivilet authored Dec 28, 2024
1 parent c00924f commit fb0671f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html>
<head>
<title>Text Search Worker Memory Test</title>
Expand All @@ -7,7 +7,10 @@
<script type="module">
window.__workerDidLaunch = 0 // 0: not launched, 1: launched, 2: error

const worker = new Worker('/dist/aboutWorkerMain.js')
const worker = new Worker('/dist/aboutWorkerMain.js', {
type: 'module',
name: 'Worker',
})
const channel = new MessageChannel()

// Send initialize message with message port
Expand All @@ -18,7 +21,7 @@
method: 'initialize',
params: ['message-port', channel.port2],
},
[channel.port2],
[channel.port2]
)

worker.onmessage = (event) => {
Expand Down

0 comments on commit fb0671f

Please sign in to comment.