fix: add missing EventsOffAll export to runtime templates (#4883)

* fix: add missing EventsOffAll export to runtime templates

The EventsOffAll function was implemented in the internal runtime
(desktop/events.js) and exported in the wrapper runtime files, but was
missing from the public runtime templates that are generated in user
projects. This caused a type mismatch where EventsOffAll was declared
in the TypeScript definition but the implementation was missing.

This commit adds the EventsOffAll export and type declaration to all
frontend framework templates:
- Common templates (generate/assets/common)
- React / React-TS
- Vue / Vue-TS
- Svelte / Svelte-TS
- Preact / Preact-TS
- Lit / Lit-TS
- Vanilla / Vanilla-TS

Fixes #4703

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* docs: add EventsOffAll to runtime events documentation

Added EventsOffAll function documentation to both English and Chinese
versions of the runtime events reference.

The function was already implemented in Go (pkg/runtime/events.go) and
JavaScript (internal/frontend/runtime/desktop/events.js), but was missing
from the public documentation.

Related to #4703

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* chore: add EventsOffAll fix to changelog

Added entry for the EventsOffAll fix to the Unreleased section
of the changelog.

Related to #4703

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* docs: translate EventsOffAll description to Chinese

Improved consistency in Chinese documentation by translating the
EventsOffAll description from English to Chinese, matching the
style of other event method descriptions.

Related to #4703

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: cc <Zhuanz@MacBook-Pro.local>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
NarciLee 2026-01-25 10:10:24 +08:00 committed by GitHub
commit 4e8b705cda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 119 additions and 0 deletions

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -52,6 +52,10 @@ export function EventsOnce(eventName: string, callback: (...data: any) => void):
// unregisters the listener for the given event name.
export function EventsOff(eventName: string): void;
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
// unregisters all event listeners.
export function EventsOffAll(): void;
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
// logs the given message as a raw message
export function LogPrint(message: string): void;

View file

@ -48,6 +48,10 @@ export function EventsOff(eventName) {
return window.runtime.EventsOff(eventName);
}
export function EventsOffAll() {
return window.runtime.EventsOffAll();
}
export function EventsOnce(eventName, callback) {
EventsOnMultiple(eventName, callback, 1);
}

View file

@ -23,6 +23,13 @@ This method unregisters the listener for the given event name, optionally multip
Go: `EventsOff(ctx context.Context, eventName string, additionalEventNames ...string)`<br/>
JS: `EventsOff(eventName string, ...additionalEventNames)`
### EventsOffAll
This method unregisters all event listeners.
Go: `EventsOffAll(ctx context.Context)`<br/>
JS: `EventsOffAll()`
### EventsOnce
This method sets up a listener for the given event name, but will only trigger once. It returns a function to cancel

View file

@ -18,6 +18,13 @@ This method unregisters the listener for the given event name, optionally multip
Go: `EventsOff(ctx context.Context, eventName string, additionalEventNames ...string)`<br/> JS: `EventsOff(eventName string, ...additionalEventNames)`
### EventsOffAll 移除所有事件侦听器
此方法注销所有事件侦听器。
Go: `EventsOffAll(ctx context.Context)`<br/>
JS: `EventsOffAll()`
### EventsOnce 添加只触发一次的事件侦听器
此方法为给定的事件名称设置一个侦听器,但只会触发一次。 它返回 一个函数来取消侦听器。

View file

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed missing `EventsOffAll` in runtime templates for all frontend frameworks [#4883](https://github.com/wailsapp/wails/pull/4883) by @narcilee7
- Fixed Linux crash on panic in JS-bound Go methods due to WebKit overriding signal handlers [#3965](https://github.com/wailsapp/wails/issues/3965) by @leaanthony
- Fixed code block range in "How Does It Work?" documentation [#4884](https://github.com/wailsapp/wails/pull/4884) by @msal4
- Fixed WebView crash on macOS 26 (Tahoe) during rapid UI updates [#4592](https://github.com/wailsapp/wails/issues/4592) by @leaanthony