<script lang="ts">
import {tick} from 'svelte'
let count = 0;
let initialized = false;
const getProps = function () {
if (!initialized) {
initialized = true;
tick().then(() => {
const el = document.querySelector('[data-counter]');
el.addEventListener('click', () => count++)
})
}
return {
'data-counter': ''
}
}
</script>
<button {...getProps()}>
Count: {count}
</button>