MCPcopy Create free account
hub / github.com/DavidWells/analytics / isScriptLoaded

Function isScriptLoaded

packages/analytics-plugin-segment/src/browser.js:143–151  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

141 var analytics = window.analytics = window.analytics || []
142
143 function isScriptLoaded() {
144 const scripts = document.getElementsByTagName('script')
145 const scriptMatch = customScriptSrc || 'cdn.segment.com/analytics.js/v1/'
146 return !!Object.keys(scripts).filter((key) => {
147 const scriptInfo = scripts[key] || {}
148 const src = scriptInfo.src || ''
149 return src.indexOf(scriptMatch) > -1
150 }).length
151 }
152
153 if (!analytics.initialize) {
154 if (!isScriptLoaded()) {

Callers 1

initializeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected