wailsapp / wails

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

[v2][runtime][js] EventsOn does not return a function to cancel #2433

Closed zllovesuki closed 1 year ago

zllovesuki commented 1 year ago

Description

EventsOn in the JavaScript runtime should've returned a function to cancel the listener, but it is undefined for some reasons

To Reproduce

Running this with the starter vue-ts project

<script lang="ts" setup>
import { onMounted } from "vue";
import { EventsOn } from "../wailsjs/runtime/runtime";

onMounted(() => {
  const x = EventsOn("wat", () => {});
  console.log("onMounted", x);
});
</script>

Expected behaviour

EventsOn should return a function to cancel watcher.

Screenshots

image

Attempted Fixes

No response

System Details

PS D:\Vendetta\code\wat> wails doctor
DEB | Using go webview2loader
Wails CLI v2.3.1

Scanning system - Please wait (this may take a long time)...Done.

# System

OS           | Windows 10 Pro
Version      | 2009 (Build: 19044)
ID           | 21H2
Go Version   | go1.20.1
Platform     | windows
Architecture | amd64

# Wails

Version | v2.3.1

# Dependencies

Dependency | Package Name | Status    | Version
WebView2   | N/A          | Installed | 110.0.1587.57
npm        | N/A          | Installed | 9.3.1
*upx       | N/A          | Available |
*nsis      | N/A          | Available |
* - Optional Dependency

# Diagnosis

Your system is ready for Wails development!
Optional package(s) installation details:
  - upx : Available at https://upx.github.io/
  - nsis : More info at https://wails.io/docs/guides/windows-installer/

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony

Additional context

No response

zllovesuki commented 1 year ago

Seems like wails generate module does not return from the function: image