How to detect offline mode in Retool Mobile using JavaScript?

Hi!
I'm building a mobile app with Retool Mobile and would like to detect whether the app is currently offline (no internet connection) using JavaScript.
Is there a recommended way to check network status in Retool Mobile apps? Ideally, I want to trigger different logic when the app goes offline or comes back online.

Thanks in advance!

Welcome to the community, @Illia_Pavlov! Thanks for reaching out.

I think this should answer your question, but let me know if you need any additional clarification. :+1: