Skip to content

Wails Svelte Events question #4055

Answered by nigel-dev
FreezeManny asked this question in Q&A
Discussion options

You must be logged in to vote

So I think the issue is with your registering of the event handler on the JS side. Here is my example using wails init -n myproject -t svelte-ts

In my example its runtime.EventsOn whereas yours is runtime.Events.On

Here's my demo code

App.svelte

<script lang="ts">
  import logo from './assets/images/logo-universal.png'
  import {Greet} from '../wailsjs/go/main/App.js'
  import {EventsOn} from "../wailsjs/runtime";


  let resultText: string = "Please enter your name below 👇"
  let name: string
  let count: number

  function greet(): void {
    Greet(name).then(result => resultText = result)
  }
  EventsOn("tick", (message)=>{
    count = message
  })
</script>

<main>
  <img alt="Wails l…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@FreezeManny
Comment options

@nigel-dev
Comment options

Answer selected by FreezeManny
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants