pawajs 1.4.39 → 1.4.41
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/index.js +24 -18
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -324,31 +324,37 @@ export const createIntersectionObserver = (element, observeBy) => {
|
|
|
324
324
|
observer.observe(observeBy || element);
|
|
325
325
|
return observer;
|
|
326
326
|
}
|
|
327
|
-
RegisterComponent.lazy=
|
|
328
|
-
if (typeof args[0] === 'string') {
|
|
327
|
+
RegisterComponent.lazy=(...args)=>{
|
|
329
328
|
for (let i = 0; i < args.length; i += 2) {
|
|
330
329
|
const name = args[i];
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
if (typeof
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
330
|
+
const componentFunc = args[i + 1];
|
|
331
|
+
|
|
332
|
+
if (typeof componentFunc !== 'function') {
|
|
333
|
+
console.warn('Mismatched arguments for RegisterComponent. Expected pairs of (string|string[], function).');
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
const processName =(compName) => {
|
|
338
|
+
if (components.has(compName.toUpperCase()) || lazyComponents.has(compName.toUpperCase()) && !__pawaDev.tool) return;
|
|
339
|
+
|
|
340
|
+
if (typeof compName === 'string') {
|
|
341
|
+
lazyComponents.set(compName.toUpperCase(), { name: compName, component: componentFunc });
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
if (Array.isArray(name)) {
|
|
346
|
+
for (const compName of name) {
|
|
347
|
+
processName(compName);
|
|
344
348
|
}
|
|
349
|
+
} else if (typeof name === 'string') {
|
|
350
|
+
processName(name);
|
|
345
351
|
} else {
|
|
346
|
-
console.warn('Mismatched arguments for RegisterComponent. Expected pairs of (string, function).');
|
|
352
|
+
console.warn('Mismatched arguments for RegisterComponent. Expected pairs of (string|string[], function).');
|
|
347
353
|
break;
|
|
348
354
|
}
|
|
349
355
|
}
|
|
350
|
-
|
|
351
|
-
|
|
356
|
+
|
|
357
|
+
|
|
352
358
|
}
|
|
353
359
|
|
|
354
360
|
/**
|