script.addEventListener('load', callback)
fires on script load and calls the callback function that we pass to it!
[ScriptLoadService object].loadScript(mapsApiUrl, 'map-script-id', () => {
const maps = window['google']['maps'];
this.map = new maps.Map( ... details here ...);
}
Notice how instead of referencing directly the google.maps
object (as we could and would be allowed to),
we are reading it explicitly from the window object.
If we reference it directly, the linter will complain because it cannot see its definition.