What's the difference between javascript libraries and native ones

Please correct me if I’m wrong here but I’m a little confused and unsure as to why native libraries for things like firebase authentication exist for capacitor? I’m under the knowledge that it is almost entirely a browser in the backend and by this logic should be able to run the normal firebase js SDK. Is this not the case or do people simply prefer the performance and integration of a truly native sign in method?

The key difference between JavaScript libraries and frameworks is that libraries consist of functions that an application can call to perform a task , while a framework defines how a developer designs an application.

Hi

for Firebase, many things can be done via JS SDK. And using JS SDK might create advantages when you want to deploy as a web app and even native app, because it could simplify your dev workflow.

JS libraries may have limitations compared to capacitor plugins or cordova plugins (built in iOS or Android native code) as the JS is running in a web view and some features don’t run well in web view. This is for instance notifications in iOS. ANd there are some firebase features (crash analytics) that don’t have a JS API (at least last time I looked).

Downside of native libs is of course you cant use them in a web app like progressive web app or simply in the browser.

So in short - JS libraries run in the webview/browser, native as native code on the device. Both can do the same for some features, but for some features one can do it (better) while the other can’t - and for some features there might be no native plugin version made available by the community.

And all this runs in the FRONTEND, not the backend.

Does this help?

Yes it does, thank you very much!

1 Like

Great

Just to add - for a signin method complexity can be high indeed

For instance, a Google login using Firebase JS requires different code in Android (popup) compared to iOS (redirect). Took me a bit to get that right. I reckon with a plugin the api is the same?

1 Like