<script>
let name = 'world';
import {Example} from './store'
const example = new Example("editable")
// if decorators were available, this could be accomplished
// by checking example.executing.delayed === "running"
let loading = false
async function execDelayed() {
if(loading){
return
}
loading = true
try {
await example.delayed()
} catch(err) {
// handle your error
console.log(err)
} finally{
loading = false
}
}
</script>
<h1>{$example.label}</h1>
<input bind:value={$example.label}>
<h1>Count: {$example.value}</h1>
<button on:click={()=>example.inc()}>+1</button>
<button on:click={execDelayed} disabled={loading}>delayed</button>