Closed programsam closed 6 years ago
Yeah it has a caching function but that wasn't the problem.
Even when it was cached, it was being told to load it multiple times. Multiple instances in the this
object (which I think is the same as the window
object). So I determined a way to check if it had been initialized/instantiated:
if (this.hasOwnProperty('google') && google.hasOwnProperty('maps'))
If it's defined, then we don't do a getScript
at all. If not defined, then there will be no exception thrown, but it'll go load the script into the DOM so that the callback function can instantiate it.
jQuery.loadScript()
has some sort of a caching function for this, yeah?