I'm looking for general guidance (eg. bullet points on what to consider) on how to ensure a JavaScript heavy app doesn't run into any conflicts with extensions.
For example, I found that I had a global function called log
, which a specific extension somehow overwrote. Since extensions can load code at various times, I'm curious what general ideas (or links/articles) people have to ensure no conflicts.
One I've discovered recently is also assume that all 3rd party scripts (from a domain other than yours) may get blocked by some over-zealous Ad Blocker, and act accordingly (eg. always check to ensure any objects or methods you're expecting to be available from those 3rd-party scripts, are in fact available, before calling them).
Appreciate any guidance or ideas here.
As for a specific question:
Is it at all problematic to extend native objects (eg. via String.prototype.trim = function() { ... };
?