Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/calvo-jp/svelte-cooldown
https://github.com/calvo-jp/svelte-cooldown
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/calvo-jp/svelte-cooldown
- Owner: calvo-jp
- Created: 2024-04-24T06:53:06.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-25T05:12:40.000Z (9 months ago)
- Last Synced: 2024-04-25T13:06:50.837Z (9 months ago)
- Language: TypeScript
- Size: 91.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Svelte Cooldown
## Installation
```bash
npm install svelte-cooldown
```## Usage
```svelte
import { createCooldown } from 'svelte-cooldown';
let cooldown = createCooldown({
min: 0,
max: 10,
duration: 10000,
autoplay: true,
allowPause: true,
oncooldown() {
/**/
},
});{cooldown.countdown}{#if context.paused}
Resume
{:else if context.cooling}
Pause
{:else}
Start
{/if}Stop
Restart
```or using the component
```svelte
import { Cooldown } from 'svelte-cooldown';
{#snippet children(context)}
{#if context.paused}
Resume
{:else if context.cooling}
Pause
{:else}
Start
{/if}
Stop
Restart
{/snippet}```