BLUE
PHP 7.4.33
Path:
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/@react-google-maps/api/src
Run
Logout
Edit File
Size: 3.50 KB
Close
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/@react-google-maps/api/src/useLoadScript.tsx
Text
Base64
/* eslint-disable filenames/match-regex */ import { useEffect, useRef, useState } from 'react' import invariant from 'invariant' import { isBrowser } from './utils/isbrowser.js' import { injectScript } from './utils/injectscript.js' import { preventGoogleFonts } from './utils/prevent-google-fonts.js' import { makeLoadScriptUrl, type LoadScriptUrlOptions, } from './utils/make-load-script-url.js' import { defaultLoadScriptProps } from './LoadScript.js' export type UseLoadScriptOptions = LoadScriptUrlOptions & { id?: string | undefined nonce?: string | undefined preventGoogleFontsLoading?: boolean | undefined } let previouslyLoadedUrl: string export function useLoadScript({ id = defaultLoadScriptProps.id, version = defaultLoadScriptProps.version, nonce, googleMapsApiKey, googleMapsClientId, language, region, libraries, preventGoogleFontsLoading, channel, mapIds, authReferrerPolicy, }: UseLoadScriptOptions): { isLoaded: boolean loadError: Error | undefined url: string } { const isMounted = useRef(false) const [isLoaded, setLoaded] = useState(false) const [loadError, setLoadError] = useState<Error | undefined>(undefined) useEffect(function trackMountedState() { isMounted.current = true return (): void => { isMounted.current = false } }, []) useEffect( function applyPreventGoogleFonts() { if (isBrowser && preventGoogleFontsLoading) { preventGoogleFonts() } }, [preventGoogleFontsLoading] ) useEffect( function validateLoadedState() { if (isLoaded) { invariant( !!window.google, 'useLoadScript was marked as loaded, but window.google is not present. Something went wrong.' ) } }, [isLoaded] ) const url = makeLoadScriptUrl({ version, googleMapsApiKey, googleMapsClientId, language, region, libraries, channel, mapIds, authReferrerPolicy, }) useEffect( function loadScriptAndModifyLoadedState() { if (!isBrowser) { return } function setLoadedIfMounted(): void { if (isMounted.current) { setLoaded(true) previouslyLoadedUrl = url } } if (window.google && window.google.maps && previouslyLoadedUrl === url) { setLoadedIfMounted() return } injectScript({ id, url, nonce }) .then(setLoadedIfMounted) .catch(function handleInjectError(err) { if (isMounted.current) { setLoadError(err) } console.warn(` There has been an Error with loading Google Maps API script, please check that you provided correct google API key (${ googleMapsApiKey || '-' }) or Client ID (${googleMapsClientId || '-'}) Otherwise it is a Network issue. `) console.error(err) }) }, [id, url, nonce] ) const prevLibraries = useRef<undefined | string[]>() useEffect( function checkPerformance() { if (prevLibraries.current && libraries !== prevLibraries.current) { console.warn( 'Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables' ) } prevLibraries.current = libraries }, [libraries] ) return { isLoaded, loadError, url } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 4 × Files: 15
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
components
DIR
-
drwxr-xr-x
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
docs
DIR
-
drwxr-xr-x
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
utils
DIR
-
drwxr-xr-x
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__tests__
DIR
-
drwxr-xr-x
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
GoogleMap.md
939 B
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
GoogleMap.stories.tsx
829 B
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
GoogleMap.tsx
16.12 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.ts
3.56 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LoadScript.tsx
6.24 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LoadScriptNext.md
198 B
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LoadScriptNext.tsx
1.29 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
map-context.ts
479 B
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
setup-tests.js
8.56 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
types.tsx
270 B
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useGoogleMap.md
275 B
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useJsApiLoader.md
1.37 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useJsApiLoader.tsx
2.71 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useLoadScript.md
1.39 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useLoadScript.tsx
3.50 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).