How to restart web workers when computer restarts from sleep mode?
问题 I have a simple webworker which keeps the current time of timezone using setInterval setInterval(() => { userTimezoneTimestamp = userTimezoneTimestamp + 1000 postMessage(userTimezoneTimestamp); }, 1000); It works fine until I put my machine on sleep mode. When I restart the machine from sleep mode, the time which I get from this worker is older. How can I restart my web worker only when the machine starts up from sleep mode? 回答1: There doesn't seem to be any DOM event letting us know about