PageSourceSearch

https://www.lanoudebergueda.cat/front/view/js/googleMapsInit.js

js lanoudebergueda.cat collected 2026-10-02 14:09:40 UTC 1,872 bytes, 60 lines download raw bytes

1/**
2 * Google Maps API Initialization
3 * This file ensures Google Maps API is loaded only once globally
4 */
5
6(function() {
7    'use strict';
8    
9    // Flag to prevent multiple loading attempts
10    if (window.googleMapsInitialized) {
11        return;
12    }
13    window.googleMapsInitialized = true;
14    
15    // Check if Google Maps is already loaded
16    if (window.google && window.google.maps) {
17        return;
18    }
19    
20    // Create a queue for callbacks waiting for Google Maps
21    window.googleMapsCallbacks = window.googleMapsCallbacks || [];
22    
23    // Function to execute when Google Maps is ready
24    window.onGoogleMapsReady = function() {
25        // Execute all queued callbacks
26        if (window.googleMapsCallbacks && window.googleMapsCallbacks.length) {
27            window.googleMapsCallbacks.forEach(function(callback) {
28                if (typeof callback === 'function') {
29                    try {
30                        callback();
31                    } catch (e) {
32                        console.error('Error executing Google Maps callback:', e);
33                    }
34                }
35            });
36        }
37        // Clear the queue
38        window.googleMapsCallbacks = [];
39    };
40    
41    // Function to register callbacks for when Maps is ready
42    window.waitForGoogleMaps = function(callback) {
43        if (typeof callback !== 'function') {
44            console.warn('waitForGoogleMaps: callback must be a function');
45            return;
46        }
47        
48        if (window.google && window.google.maps) {
49            // Google Maps is already loaded
50            try {
51                callback();
52            } catch (e) {
53                console.error('Error executing Google Maps callback:', e);
54            }
55        } else {
56            // Add to queue
57            window.googleMapsCallbacks.push(callback);
58        }
59    };
60})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.