Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/calvo-jp/svelte-cooldown


https://github.com/calvo-jp/svelte-cooldown

Last synced: 9 days ago
JSON representation

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}

```