* The installImportLibrary_ function makes sure that a usable version of the * `google.maps.importLibrary` function exists.
(options: APIOptions)
| 127 | * `google.maps.importLibrary` function exists. |
| 128 | */ |
| 129 | function installImportLibrary_(options: APIOptions) { |
| 130 | const importLibraryExists = Boolean(window.google?.maps?.importLibrary); |
| 131 | if (importLibraryExists) { |
| 132 | logDevNotice(MSG_IMPORT_LIBRARY_EXISTS(options)); |
| 133 | } else if (__DEV__) { |
| 134 | const scriptEl = document.querySelector( |
| 135 | 'script[src*="maps.googleapis.com/maps/api/js"]' |
| 136 | ); |
| 137 | |
| 138 | if (scriptEl) { |
| 139 | logDevWarning(MSG_SCRIPT_ELEMENT_EXISTS); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // If the google.maps.importLibrary function already exists, bootstrap() |
| 144 | // won't do anything, so we won't call it |
| 145 | if (!importLibraryExists) { |
| 146 | bootstrap(options); |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | // export the deprecated (and non-functional) Loader class to trigger a strong |
| 151 | // error-message for users migrating to the new version |
no test coverage detected
searching dependent graphs…