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
|
|
@ -620,7 +620,12 @@ export default class AppFilesScanner {
|
||||||
if ( scannerVersion === '2' ) {
|
if ( scannerVersion === '2' ) {
|
||||||
|
|
||||||
|
|
||||||
const { scan } = await runScanWorker( file.instance )
|
const { scan } = await runScanWorker( file.instance, messageDetails => {
|
||||||
|
console.log( 'messageDetails', messageDetails )
|
||||||
|
|
||||||
|
file.statusMessage = messageDetails.message
|
||||||
|
file.status = messageDetails.status
|
||||||
|
} )
|
||||||
|
|
||||||
console.log('scan', scan)
|
console.log('scan', scan)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import AppScanWorker from './worker.mjs?worker'
|
import AppScanWorker from './worker.mjs?worker'
|
||||||
|
|
||||||
export async function runScanWorker ( file ) {
|
const noop = () => {}
|
||||||
|
|
||||||
|
export async function runScanWorker ( file, messageReceiver = noop ) {
|
||||||
// console.log( 'file', file )
|
// console.log( 'file', file )
|
||||||
|
|
||||||
const appScanWorker = new AppScanWorker()
|
const appScanWorker = new AppScanWorker()
|
||||||
|
|
@ -12,7 +14,9 @@ export async function runScanWorker ( file ) {
|
||||||
appScanWorker.onmessage = async (event) => {
|
appScanWorker.onmessage = async (event) => {
|
||||||
// console.log( 'Main received message', event )
|
// console.log( 'Main received message', event )
|
||||||
|
|
||||||
const { status } = event.data
|
const { status, message } = event.data
|
||||||
|
|
||||||
|
messageReceiver({ status, message })
|
||||||
|
|
||||||
// Resolves promise on finished status
|
// Resolves promise on finished status
|
||||||
if ( status === 'finished' ) {
|
if ( status === 'finished' ) {
|
||||||
|
|
@ -23,10 +27,11 @@ export async function runScanWorker ( file ) {
|
||||||
|
|
||||||
// Set up the worker error handler
|
// Set up the worker error handler
|
||||||
appScanWorker.onerror = async ( errorEvent ) => {
|
appScanWorker.onerror = async ( errorEvent ) => {
|
||||||
// console.log( 'appScanWorker.onerror', errorEvent )
|
console.error( 'Error received from App Scan Worker', errorEvent )
|
||||||
reject()
|
reject()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Start the worker
|
// Start the worker
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage
|
// https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage
|
||||||
appScanWorker.postMessage( {
|
appScanWorker.postMessage( {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue