Uncaught (in promise): SplashScreen does not have web implementation (no Promise to chatch)
See original GitHub issueYes we know, SplashScreen is for mobile devices and probably not supported also on PWA, at least it is not documented.
But if we run SplashScreen on ionic serve
, we run into this error. So having a look from PWA documentation https://capacitor.ionicframework.com/docs/basics/progressive-web-app there is
If your app makes native plugin calls that don’t have a web substitute, such as SplashScreen.show(), the app will allow those calls without crashing. Calls that return a promise will return a rejected promise, which you should be handling in your app anyways.
But neither show()
nor hide()
has promise to catch. We can only check for Capacitor.isPluginAvailable
and omit the calls.
Same thing on Network
plugin. Shouldn’t work the plugins in ionic serve as for PWA’s?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
This works for me on
StatusBar
import { Plugins, PluginRegistry, Capacitor } from '@capacitor/core';
const { SplashScreen, StatusBar }: PluginRegistry = Plugins;
if (Capacitor.isPluginAvailable('StatusBar')) { StatusBar.show() };
As this is still happening with latest capacitor 1.3.0… @mlynch philosophically speaking, isn’t it capacitor’s job to “catch” this exception? Or better yet, shouldn’t capacitor provide a web implementation for things like SplashScreen and simply be a noop?