@cocreate/lazy-loader 1.16.0 → 1.17.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # [1.17.0](https://github.com/CoCreate-app/CoCreate-lazy-loader/compare/v1.16.0...v1.17.0) (2024-02-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * $param handeling ([4f1cafc](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/4f1cafc6c598aad0b3e09c794d2a08874560538f))
7
+ * Removed https://cdn.cocreate.app/latest/CoCreate.min.css ([538dd6a](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/538dd6a41df1d32fa71b46c3b2d0da7158c46d74))
8
+
9
+
10
+ ### Features
11
+
12
+ * operate $param[] ([61181ad](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/61181ad37545b186336bb1a361aff1602ae6868f))
13
+
1
14
  # [1.16.0](https://github.com/CoCreate-app/CoCreate-lazy-loader/compare/v1.15.2...v1.16.0) (2024-01-30)
2
15
 
3
16
 
package/docs/index.html CHANGED
@@ -19,10 +19,6 @@
19
19
  <meta name="robots" content="index,follow" />
20
20
 
21
21
  <!-- CoCreate CSS CDN -->
22
- <link
23
- rel="stylesheet"
24
- href="https://cdn.cocreate.app/latest/CoCreate.min.css"
25
- type="text/css" />
26
22
 
27
23
  <link rel="manifest" href="/manifest.webmanifest" />
28
24
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/lazy-loader",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "A simple lazy-loader component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "lazy-loader",
package/src/server.js CHANGED
@@ -47,6 +47,7 @@ class CoCreateLazyLoader {
47
47
  const valideUrl = new URL(`http://${req.headers.host}${req.url}`);
48
48
  const hostname = valideUrl.hostname;
49
49
  let organization
50
+
50
51
  try {
51
52
  organization = await this.crud.getOrganization({ host: hostname });
52
53
  } catch {
@@ -171,7 +172,19 @@ class CoCreateLazyLoader {
171
172
  if (typeof method !== 'function')
172
173
  throw new Error(`Method ${data.method} is not a function.`);
173
174
 
174
- let params = data.$params || [data[name]]
175
+ let params = [], mainParam = false
176
+ for (let i = 0; true; i++) {
177
+ if (`$param[${i}]` in data[name]) {
178
+ params.push(data[name][`$param[${i}]`])
179
+ delete data[name][`$param[${i}]`]
180
+ } else if (!mainParam) {
181
+ params.push(data[name])
182
+ mainParam = true
183
+ } else {
184
+ break;
185
+ }
186
+ }
187
+
175
188
  data.postmark = await method.apply(instance, params);
176
189
  return data
177
190
  } catch (error) {