MCPcopy
hub / github.com/ampproject/amphtml / loadScript

Function loadScript

3p/3p.js:85–96  ·  view source on GitHub ↗
(win, url, opt_cb, opt_errorCb)

Source from the content-addressed store, hash-verified

83 * @param {function()=} opt_errorCb
84 */
85export function loadScript(win, url, opt_cb, opt_errorCb) {
86 /** @const {!Element} */
87 const s = win.document.createElement('script');
88 s.src = url;
89 if (opt_cb) {
90 s.onload = opt_cb;
91 }
92 if (opt_errorCb) {
93 s.onerror = opt_errorCb;
94 }
95 win.document.body.appendChild(s);
96}
97
98/**
99 * Call function in micro task or timeout as a fallback.

Callers 15

viqeoplayerFunction · 0.90
getBeOpinionFunction · 0.90
getFacebookSdkFunction · 0.90
getTwttrFunction · 0.90
initRecaptchaFunction · 0.90
getBodymovinAnimationSdkFunction · 0.90
getContainerScriptFunction · 0.90
getEmbedlyFunction · 0.90
getContainerScriptFunction · 0.90
loadScriptCbFunction · 0.90
test-3p.jsFile · 0.90
imaVideoFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected