<template>
  <q-page padding>
    <q-input v-model="ld.name" label='İsim'/>
    <q-btn label="Selamla" @click="doGreet" />
    {{ld.result}}
  </q-page>
</template>

<script setup>
import { onMounted, reactive } from 'vue'
// import {Events} from "@wailsio/runtime";

const ld = reactive({
  name: '',
  result: '',
  time: ''
})

/*
onMounted(() => {
  Events.On('time', (timeValue) => {
    console.log(timeValue)
    ld.time = timeValue.data;
  });
})
*/

const doGreet = () => {
  let localName = ld.name;
  if (!localName) {
    localName = 'anonymous';
  }
  Greet(localName).then((resultValue) => {
    ld.result = resultValue;
  }).catch((err) => {
    console.log(err);
  });
}
</script>
