mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Fix scan page not receiving v2 messages
This commit is contained in:
parent
c79603b361
commit
9e1a7c0158
2 changed files with 14 additions and 4 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import AppScanWorker from './worker.mjs?worker'
|
||||
|
||||
export async function runScanWorker ( file ) {
|
||||
const noop = () => {}
|
||||
|
||||
export async function runScanWorker ( file, messageReceiver = noop ) {
|
||||
// console.log( 'file', file )
|
||||
|
||||
const appScanWorker = new AppScanWorker()
|
||||
|
|
@ -12,7 +14,9 @@ export async function runScanWorker ( file ) {
|
|||
appScanWorker.onmessage = async (event) => {
|
||||
// console.log( 'Main received message', event )
|
||||
|
||||
const { status } = event.data
|
||||
const { status, message } = event.data
|
||||
|
||||
messageReceiver({ status, message })
|
||||
|
||||
// Resolves promise on finished status
|
||||
if ( status === 'finished' ) {
|
||||
|
|
@ -23,10 +27,11 @@ export async function runScanWorker ( file ) {
|
|||
|
||||
// Set up the worker error handler
|
||||
appScanWorker.onerror = async ( errorEvent ) => {
|
||||
// console.log( 'appScanWorker.onerror', errorEvent )
|
||||
console.error( 'Error received from App Scan Worker', errorEvent )
|
||||
reject()
|
||||
}
|
||||
|
||||
|
||||
// Start the worker
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage
|
||||
appScanWorker.postMessage( {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue