Debounce

This composable provides an easy way to handle debounced events.

export default defineComponent({
  setup() {
    const count = ref(0);

    const onUpdate = (newValue: number) => {
      count.value = newValue;
    };

    const onClick = () => {
      debounce(count.value + 1);
    };

    const debounce = useDebounce(onUpdate, 250);

    return () => (
      <TButton design="raised" onClick={onClick}>
        Count is {count.value}
      </TButton>
    );
  },
});