How to execute the code before main app is fully loaded?



I have a web app (react based) that needs to use some native functionality (namely, speech recognition and push notifications). I don’t want to bundle assets on the phone as the API changes time to time and I don’t want to support a versioned API. I was able to make it work with capacitor and cordova plugins by pointing "server": { "url": ... } property in capacitor.config.json to my web app. This works, but it would be nice to have some checks like network presence, to inform the user that the Internet isn’t available instead of just showing the white screen. Is it possible to do somehow with capacitor?


To be clear, what I want ideally is to load the app as per default settings (I mean, using the embedded webserver that is serving from localhost:port), do some stuff with plugins etc, then replace the page in the webview with the remote URL. location.replace() doesn’t work – it opens in the external browser.