102
Views
1
Comments
[Common Plugin] Error cordova is not defined gets logged
Question
Forge component by OutSystems R&D
26
Published on 19 Dec 2018

Invoking GetPlatform on a browser logs an error "cordova is not defined" unnecessarily, and then returns an empty value. This might pollute error logs if your developers use a browser to test the app, or if you're distributing using PWA.


To fix, simply include an IF checking if IsCordovaDefined:


I would also remove the error handlers in this module, which follow the Error Hiding anti-pattern, and could be hiding other issues, although I haven't detected anything else so far.

I'm attaching the module with my suggested changes.

CommonPlugin.oml

Rank: #90

Leonardo,

This is super helpful having the same-ish issues with a PWA.