Skip to content

Commit 3bb3643

Browse files
committed
chore(packages/svelte): add favicon, improve demo
1 parent 98073ac commit 3bb3643

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

packages/svelte/src/routes/+page.svelte

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,24 @@
55
66
let fw: Fireworks
77
let enabled = true
8+
let count = 1
89
let options: FireworksOptions = {
910
opacity: 0.5
1011
}
1112
13+
function launchFireworks() {
14+
if (enabled) toggleFireworks()
15+
fw.fireworksInstance().launch(count)
16+
}
17+
1218
function toggleFireworks() {
1319
const fireworks = fw.fireworksInstance()
14-
if (fireworks.isRunning) {
15-
fireworks.waitStop()
16-
} else {
20+
21+
enabled = !enabled
22+
if (enabled) {
1723
fireworks.start()
24+
} else {
25+
fireworks.stop()
1826
}
1927
}
2028
@@ -26,16 +34,21 @@
2634

2735
<main>
2836
<div class="buttons">
29-
<button on:click={() => (enabled = !enabled)}>
30-
{enabled ? 'Enabled' : 'Disabled'}
31-
</button>
3237
<button on:click={() => toggleFireworks()}>
33-
Toggle
38+
{enabled ? 'Stop' : 'Start'}
39+
</button>
40+
<button on:click={() => launchFireworks()}>
41+
Launch
3442
</button>
43+
<input
44+
bind:value={count}
45+
min="1"
46+
max="15"
47+
type="number"
48+
placeholder="count"
49+
/>
3550
</div>
36-
{#if enabled}
37-
<Fireworks bind:this={fw} autostart={false} {options} class="fireworks" />
38-
{/if}
51+
<Fireworks bind:this={fw} autostart={enabled} {options} class="fireworks" />
3952
</main>
4053

4154
<style>

packages/svelte/static/favicon.png

1.34 KB
Loading

0 commit comments

Comments
 (0)