MCPcopy Create free account
hub / github.com/arfct/itty-bitty / loadScript

Function loadScript

docs/bitty.js:398–414  ·  view source on GitHub ↗
(src, type, callback)

Source from the content-addressed store, hash-verified

396}
397
398function loadScript(src, type, callback) {
399 let script = document.getElementById(src);
400
401 if (script) {
402 return Promise.resolve(script);
403 }
404 let promise = new Promise((resolve, reject) => {
405 console.log("📜 Loading Script:", src)
406
407 script = document.createElement("script")
408 if (type && type.length) script.type = type;
409 script.onload = () => resolve(script);
410 script.src = script.id = src;
411 document.head.appendChild(script);
412 })
413 return callback ? promise.then(callback) : promise;
414}
415
416// iMessage incorrectly handles urls with more than 301 sequential non-breakable characters, so we introduce = to prevent this
417function escapeStringForIMessage(str) {

Callers 5

decompressDataFunction · 0.70
encryptDataFunction · 0.70
decryptDataFunction · 0.70
script.jsFile · 0.50
ipfs.jsFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected