Skip to content

Commit e52179c

Browse files
committed
fix: small minor fixes
1 parent ee8f0ef commit e52179c

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

bundles/fireworks/src/fireworks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ declare global {
4444
}
4545

4646
const explodeSoundCheck = (args: CustomEventArgs): boolean => {
47-
const data = args.data as { particle: Particle };
47+
const data = args.data as { particle?: Particle } | undefined;
4848

49-
return data.particle.options.move.gravity.enable;
49+
return data?.particle?.options.move.gravity.enable ?? false;
5050
};
5151

5252
/**

demo/vanilla/public/javascripts/confetti.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ async function frame() {
2020
]);
2121

2222
if (Date.now() < end) {
23-
setTimeout(frame, 15);
23+
setTimeout(() => {
24+
frame().catch(error => {
25+
console.error("Confetti frame error:", error);
26+
});
27+
}, 15);
2428
}
2529
}
2630

2731
(async () => {
2832
await confetti.init();
2933

3034
await frame();
31-
})();
35+
})().catch(error => {
36+
console.error("Confetti initialization error:", error);
37+
});

utils/configs/src/f/fireworks3.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EventType, type ISourceOptions, type Particle, identity } from "@tsparticles/engine";
1+
import { type CustomEventArgs, EventType, type ISourceOptions, type Particle, identity } from "@tsparticles/engine";
22

33
const thirdFactor = 3,
44
third = identity / thirdFactor,
@@ -192,10 +192,10 @@ const thirdFactor = 3,
192192
events: [
193193
{
194194
event: EventType.particleRemoved,
195-
filter: (args: unknown): boolean => {
196-
const data = (args as { data?: { particle?: Particle } }).data;
195+
filter: (args: CustomEventArgs): boolean => {
196+
const particle = (args.data as { particle?: Particle } | undefined)?.particle;
197197

198-
return data?.particle?.options.move.gravity.enable ?? false;
198+
return particle?.options.move.gravity.enable ?? false;
199199
},
200200
audio: [
201201
"https://particles.js.org/audio/explosion0.mp3",

0 commit comments

Comments
 (0)