@symbo.ls/utils 2.11.411 → 2.11.417

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1606,7 +1606,7 @@ var loadJavascriptFile = (FILE_URL, async = false, doc = document, type = "text/
1606
1606
  }
1607
1607
  });
1608
1608
  };
1609
- var loadJavascriptFileSync = (FILE_URL, doc = document, type = "text/javascript") => {
1609
+ var loadJavascriptFileSync = (FILE_URL, doc = document, fallback, type = "text/javascript") => {
1610
1610
  const xhr = new window.XMLHttpRequest();
1611
1611
  xhr.open("GET", FILE_URL, false);
1612
1612
  xhr.send();
@@ -1615,6 +1615,8 @@ var loadJavascriptFileSync = (FILE_URL, doc = document, type = "text/javascript"
1615
1615
  scriptEle.type = type;
1616
1616
  scriptEle.text = xhr.responseText;
1617
1617
  doc.body.appendChild(scriptEle);
1618
+ if (typeof fallback === "function")
1619
+ fallback();
1618
1620
  } else {
1619
1621
  throw new Error(`Failed to load the script ${FILE_URL}`);
1620
1622
  }
package/dist/cjs/load.js CHANGED
@@ -50,7 +50,7 @@ var loadJavascriptFile = (FILE_URL, async = false, doc = document, type = "text/
50
50
  }
51
51
  });
52
52
  };
53
- var loadJavascriptFileSync = (FILE_URL, doc = document, type = "text/javascript") => {
53
+ var loadJavascriptFileSync = (FILE_URL, doc = document, fallback, type = "text/javascript") => {
54
54
  const xhr = new window.XMLHttpRequest();
55
55
  xhr.open("GET", FILE_URL, false);
56
56
  xhr.send();
@@ -59,6 +59,8 @@ var loadJavascriptFileSync = (FILE_URL, doc = document, type = "text/javascript"
59
59
  scriptEle.type = type;
60
60
  scriptEle.text = xhr.responseText;
61
61
  doc.body.appendChild(scriptEle);
62
+ if (typeof fallback === "function")
63
+ fallback();
62
64
  } else {
63
65
  throw new Error(`Failed to load the script ${FILE_URL}`);
64
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/utils",
3
- "version": "2.11.411",
3
+ "version": "2.11.417",
4
4
  "author": "symbo.ls",
5
5
  "files": [
6
6
  "src",
@@ -26,5 +26,5 @@
26
26
  "dependencies": {
27
27
  "@domql/utils": "latest"
28
28
  },
29
- "gitHead": "e45830a80e83324329963be4d39dc5b0aa50d43d"
29
+ "gitHead": "d3f5ad50e57320d72c7d50bc0309f3308e6b8ff2"
30
30
  }
package/src/load.js CHANGED
@@ -28,7 +28,7 @@ export const loadJavascriptFile = (FILE_URL, async = false, doc = document, type
28
28
  })
29
29
  }
30
30
 
31
- export const loadJavascriptFileSync = (FILE_URL, doc = document, type = 'text/javascript') => {
31
+ export const loadJavascriptFileSync = (FILE_URL, doc = document, fallback, type = 'text/javascript') => {
32
32
  const xhr = new window.XMLHttpRequest()
33
33
  xhr.open('GET', FILE_URL, false) // false makes the request synchronous
34
34
  xhr.send()
@@ -38,6 +38,7 @@ export const loadJavascriptFileSync = (FILE_URL, doc = document, type = 'text/ja
38
38
  scriptEle.type = type
39
39
  scriptEle.text = xhr.responseText
40
40
  doc.body.appendChild(scriptEle)
41
+ if (typeof fallback === 'function') fallback()
41
42
  } else {
42
43
  throw new Error(`Failed to load the script ${FILE_URL}`)
43
44
  }