BLUE
PHP 7.4.33
Path:
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/@react-google-maps/api/src/utils
Run
Logout
Edit File
Size: 2.22 KB
Close
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/@react-google-maps/api/src/utils/injectscript.ts
Text
Base64
import { isBrowser } from './isbrowser.js' type WindowWithGoogleMap = Window & { initMap?: (() => void) | undefined } type InjectScriptArg = { url: string id: string nonce?: string | undefined } export function injectScript({ url, id, nonce, // eslint-disable-next-line @typescript-eslint/no-explicit-any }: InjectScriptArg): Promise<any> { if (!isBrowser) { return Promise.reject(new Error('document is undefined')) } return new Promise(function injectScriptCallback(resolve, reject) { const existingScript = document.getElementById(id) as | HTMLScriptElement | undefined const windowWithGoogleMap: WindowWithGoogleMap = window if (existingScript) { // Same script id/url: keep same script const dataStateAttribute = existingScript.getAttribute('data-state') if (existingScript.src === url && dataStateAttribute !== 'error') { if (dataStateAttribute === 'ready') { return resolve(id) } else { const originalInitMap = windowWithGoogleMap.initMap const originalErrorCallback = existingScript.onerror windowWithGoogleMap.initMap = function initMap(): void { if (originalInitMap) { originalInitMap() } resolve(id) } existingScript.onerror = function (err): void { if (originalErrorCallback) { originalErrorCallback(err) } reject(err) } return } } // Same script id, but either // 1. requested URL is different // 2. script failed to load else { existingScript.remove() } } const script = document.createElement('script') script.type = 'text/javascript' script.src = url script.id = id script.async = true script.nonce = nonce || '' script.onerror = function onerror(err): void { script.setAttribute('data-state', 'error') reject(err) } windowWithGoogleMap.initMap = function onload(): void { script.setAttribute('data-state', 'ready') resolve(id) } document.head.appendChild(script) }).catch((err) => { console.error('injectScript error: ', err) throw err }) }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 8
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
foreach.ts
187 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
helper.ts
2.70 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
injectscript.ts
2.22 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
isbrowser.ts
66 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
make-load-script-url.ts
1.75 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
noop.ts
40 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
prevent-google-fonts.ts
3.08 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
reduce.ts
236 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
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).