@luigi-project/container 1.8.0-dev.20261190035 → 1.8.0-dev.20261191018
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/bundle.js +1 -1
- package/bundle.js.map +1 -1
- package/constants/events.d.ts +9 -1
- package/constants/events.js +7 -1
- package/package.json +1 -1
package/constants/events.d.ts
CHANGED
|
@@ -383,7 +383,7 @@ export class LuigiEvent extends Event {
|
|
|
383
383
|
constructor(type: string, data: unknown, payload?: unknown, callback?: Function) {
|
|
384
384
|
super(type);
|
|
385
385
|
this.detail = data;
|
|
386
|
-
this.payload =
|
|
386
|
+
this.payload = this.getEventPayload(data, payload);
|
|
387
387
|
this.callbackFn = callback;
|
|
388
388
|
}
|
|
389
389
|
|
|
@@ -393,6 +393,14 @@ export class LuigiEvent extends Event {
|
|
|
393
393
|
this.callbackFn(data);
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
+
|
|
397
|
+
private getEventPayload(data: unknown, payload?: unknown): unknown {
|
|
398
|
+
if (typeof data === 'boolean' || typeof data === 'string') {
|
|
399
|
+
return data;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
return payload || data || {};
|
|
403
|
+
}
|
|
396
404
|
}
|
|
397
405
|
|
|
398
406
|
/**
|
package/constants/events.js
CHANGED
|
@@ -331,7 +331,7 @@ class LuigiEvent extends Event {
|
|
|
331
331
|
constructor(type, data, payload, callback) {
|
|
332
332
|
super(type);
|
|
333
333
|
this.detail = data;
|
|
334
|
-
this.payload =
|
|
334
|
+
this.payload = this.getEventPayload(data, payload);
|
|
335
335
|
this.callbackFn = callback;
|
|
336
336
|
}
|
|
337
337
|
callback(data) {
|
|
@@ -340,6 +340,12 @@ class LuigiEvent extends Event {
|
|
|
340
340
|
this.callbackFn(data);
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
+
getEventPayload(data, payload) {
|
|
344
|
+
if (typeof data === 'boolean' || typeof data === 'string') {
|
|
345
|
+
return data;
|
|
346
|
+
}
|
|
347
|
+
return payload || data || {};
|
|
348
|
+
}
|
|
343
349
|
}
|
|
344
350
|
/**
|
|
345
351
|
* @exports Events
|
package/package.json
CHANGED