Open noamloewenstern opened 1 year ago
That's a good idea. While I don't have the resources at this time to implement it in the library, this should work as quick-workaround:
âš This code snippet has not been tested
import pTimeout from 'p-timeout'
try {
const resp = await pTimeout(
sendMessage('messageID', { msgData: 'data' }, `content-script@123`),
{ milliseconds: 3000 }
)
} catch (err) {
// [TimeoutError: Promise timed out after 3000 milliseconds]
}
I would find it useful to add an option for timeout waiting for response, when calling "sendMessage". Something like this: