const ping_delay1 = new Worker('ping_delay1.js')
ping_delay1.onmessage = console.log
const ping_delay2 = new Worker('ping_delay2.js')
ping_delay2.onmessage = console.log
// ping_delay1.js
self.onmessage = e => {
const timestamp = Date.now()
while (Date.now() - timestamp < 5000);
self.postMessage(e.data)
}
// ping_delay2.js
self.onmessage = e => setTimeout(() => {
self.postMessage(e.data)
}, 5000)