MCPcopy Create free account
hub / github.com/googlemaps/js-api-loader / installImportLibrary_

Function installImportLibrary_

src/index.ts:129–148  ·  view source on GitHub ↗

* The installImportLibrary_ function makes sure that a usable version of the * `google.maps.importLibrary` function exists.

(options: APIOptions)

Source from the content-addressed store, hash-verified

127 * `google.maps.importLibrary` function exists.
128 */
129function 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

Callers 1

setOptionsFunction · 0.85

Calls 2

bootstrapFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…