Skip to content

Commit

Permalink
shouldDestroyAfterDone -> destroyAfterDone (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLier authored Dec 18, 2023
1 parent a933eb4 commit 95aaafe
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Width of the stage in pixels. Confetti will only fall within this width.
<ConfettiExplosion stageWidth={500} />
```

### shouldDestroyAfterDone
### destroyAfterDone

Whether or not destroy all confetti nodes after the `duration` period has passed. By default it destroys all nodes, to free up memory.

Expand All @@ -176,7 +176,7 @@ Whether or not destroy all confetti nodes after the `duration` period has passed
**Example:**

```svelte
<ConfettiExplosion shouldDestroyAfterDone={false} />
<ConfettiExplosion destroyAfterDone={false} />
```

## Style Props
Expand All @@ -199,7 +199,7 @@ You can specify two style props on the component: `--x` and `--y`. These will sh

This library functions by creating 2 DOM nodes for every single confetti. By default, if the `particlesCount` is set to 150, it will create 300 nodes. This is a lot of nodes. For most devices, these many nodes are not a big issue, but I recommend checking your target devices' performance if you choose to go with a higher number, like 400 or 500.

Also, after the specified `duration`, all the confetti DOM nodes will be destroyed. This is to free up memory. If you wish to keep them around, set `shouldDestroyAfterDone` to `false`.
Also, after the specified `duration`, all the confetti DOM nodes will be destroyed. This is to free up memory. If you wish to keep them around, set `destroyAfterDone` to `false`.

## License

Expand Down
2 changes: 1 addition & 1 deletion packages/core/demo/src/lib/Counter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
<div use:confetti={{ destroyAfterDone: false, colors }} />
{/if}

<!-- <ConfettiExplosion shouldDestroyAfterDone={false} particleCount={4} /> -->
<!-- <ConfettiExplosion destroyAfterDone={false} particleCount={4} /> -->
<style>
</style>
2 changes: 1 addition & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export function confetti(node: HTMLElement, options: ConfettiOptions = {}) {
nodes = createParticleNodes(node, particles);
}

// Dont destroy component if shouldDestroyAfterDone is false now
// Dont destroy component if destroyAfterDone is false now
if (destroyAfterDone && !newOptions.destroyAfterDone) clearTimeout(timer);

// Update stageHeight
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Size of the confetti particles in pixels
**Example:**

```svelte
<div use:confetti={{ particleSize:20 }} />
<div use:confetti={{ particleSize: 20 }} />
```

### particleShape
Expand Down Expand Up @@ -165,7 +165,7 @@ Width of the stage in pixels. Confetti will only fall within this width.
<div use:confetti={{ stageWidth: 500 }} />
```

### shouldDestroyAfterDone
### destroyAfterDone

Whether or not destroy all confetti nodes after the `duration` period has passed. By default it destroys all nodes, to free up memory.

Expand Down

0 comments on commit 95aaafe

Please sign in to comment.