@web-atoms/web-controls 2.4.12 → 2.4.14

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.
Files changed (2) hide show
  1. package/index.js +17 -16
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,11 +1,11 @@
1
- (function () {
1
+ (() => {
2
2
 
3
3
  let script = document.currentScript;
4
4
  let src = script.src;
5
5
  let index = src.lastIndexOf("/");
6
6
  src = src.substring(0, index);
7
7
 
8
- function loadScript(url) {
8
+ const loadScript = (url) => {
9
9
  return new Promise((resolve, reject) => {
10
10
  var script = document.createElement("script");
11
11
  script.type = "text/javascript";
@@ -28,9 +28,9 @@
28
28
  };
29
29
  document.body.appendChild(s);
30
30
  });
31
- }
31
+ };
32
32
 
33
- function loadPackage() {
33
+ const loadPackage = () => {
34
34
 
35
35
  let package = script.getAttribute("data-package");
36
36
  let packageRoot = script.getAttribute("data-package-root");
@@ -49,19 +49,13 @@
49
49
 
50
50
  const packed = JSON.parse(script.getAttribute("data-packed") ?? "true");
51
51
  const min = JSON.parse(script.getAttribute("data-min") ?? "true");
52
-
53
- const viewUrl = `${packageRoot}/${view}${packed ? ".pack" : ""}${min ? ".min" : ""}.js`;
54
52
  const viewName = view.startsWith("@") ? view : `${package}/${view}`;
55
53
 
56
- loadScript(viewUrl).then(() => {
57
- function empty () {
58
- return function () {
59
- return null
60
- }
61
- }
62
-
54
+ const init = () => {
55
+ const empty = () => () => null;
56
+
63
57
  AmdLoader.moduleProgress = empty;
64
- function done () {
58
+ const done = () => {
65
59
  const we = document.getElementById("webAtomsLoader");
66
60
  if (we) {
67
61
  we.remove();
@@ -80,9 +74,16 @@
80
74
  }
81
75
  }
82
76
  UMD.loadView(viewName, 0).then(done);
83
- });
77
+ }
84
78
 
85
- }
79
+ if (!packed) {
80
+ init();
81
+ return;
82
+ }
83
+
84
+ const viewUrl = `${packageRoot}/${view}${packed ? ".pack" : ""}${min ? ".min" : ""}.js`;
85
+ loadScript(viewUrl).then(init);
86
+ };
86
87
 
87
88
  loadPackage();
88
89
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web-atoms/web-controls",
3
- "version": "2.4.12",
3
+ "version": "2.4.14",
4
4
  "description": "HTML controls for web atoms core",
5
5
  "main": "index.js",
6
6
  "scripts": {