(src, type, callback)
| 396 | } |
| 397 | |
| 398 | function 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 |
| 417 | function escapeStringForIMessage(str) { |
no outgoing calls
no test coverage detected