Canonical way to detect if we're inside Capacitor

I’m migrating over from Cordova. Very excited to try out Capacitor.

I share my web code with my hybrid native apps, and all over the place I do this:

!!window.cordova to know if I’m running on a web browser vs an app store app.

I think this may continue to work in Capacitor, as there’s an object there, but it doesn’t sound right.

What’s the canonical way to detect that I’m in a capacitor context? I searched through the docs but couldn’t find anything.

Thanks for any help. This is a great library.



While you wait for better answers, here’s what I decided to do about this. My app code doesn’t really care whether it’s running under cordova or capacitor or neither - all it wants to know is whether it should try to enable drag-and-drop or open cameras or whatnot. So I put those things in environment properties, and manage them via the ng cli.