wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
25.34k stars 1.22k forks source link

EventsEmit listening conditions #3067

Closed GoMateoGo closed 12 months ago

GoMateoGo commented 12 months ago

Description

When go executes EventsEmit, but the front-end does not listen to the data carried by this event You must load the page through routing on the front-end before you can listen to events, The listening events for JS are in the. ts file

To Reproduce

  1. Write an EventsEmit listener
  2. Create 2 pages. I created them through Vue
  3. The monitoring of JS is in a separate TS file
  4. Set up routing for 2 pages
  5. Referencing data for listening events on non default routing pages
  6. Calling Go's Listening
  7. At this point, JS did not listen to the data
  8. Jump to the page where you are listening for data and call go again to listen for events
  9. Received listening data
  10. image

  11. image

Expected behaviour

No matter which page it is on, if there is listening data during go execution, JS should receive listening data

Screenshots

No response

Attempted Fixes

No response

System Details

# Wails
Version | v2.6.0

# System
┌──────────────────────────────────────┐
| OS           | Windows 10 Enterprise |
| Version      | 2009 (Build: 22621)   |
| ID           | 22H2                  |
| Go Version   | go1.20.4              |
| Platform     | windows               |
| Architecture | amd64                 |
└──────────────────────────────────────┘

# Dependencies
┌───────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version       |
| WebView2   | N/A          | Installed | 119.0.2151.72 |
| Nodejs     | N/A          | Installed | 18.16.1       |
| npm        | N/A          | Installed | 9.5.1         |
| *upx       | N/A          | Available |               |
| *nsis      | N/A          | Available |               |
└─────────────── * - Optional Dependency ───────────────┘

Additional context

vue3 TypeScript vue-router4x

GoMateoGo commented 12 months ago

Resolved, listening failed because the ts file was not loaded by default