chrisguttandin / worker-timers-broker

The broker which is used by the worker-timers package.
MIT License
5 stars 2 forks source link

TypeError Cannot read properties of undefined (reading 'message') #283

Open chaitanya71998 opened 3 hours ago

chaitanya71998 commented 3 hours ago

Hi,

We are encountering an issue related to worker-timers-broker. image

Could you please share insights on what might trigger this error and under what conditions it typically occurs?

Details we've found:

The issue is occurring in Chrome, version 126.0.0 and above. We would appreciate any guidance or suggestions on how to resolve this issue.

Thank you!

chrisguttandin commented 2 hours ago

Hi @chaitanya71998, thanks for reporting this.

The error message implies that the Web Worker sends an unexpected message. Can you share how you are using the library?

chaitanya71998 commented 2 hours ago

Hi @chrisguttandin we are using like below:

import * as workerTimers from 'worker-timers'

   startTimer = (): void => {
      this.intervalId = workerTimers.setInterval(() => {
         this.timerInSec += 1
         if (this.timerInSec > 5) {
            this.clearRequiredDataAndShowDiscussionModal()
         }
      }, 1000)
   }

    stopTimer = (): void => {
      workerTimers.clearInterval(this.intervalId)
   }