Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 7 additions & 0 deletions website/docs/reference/runtime/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Comment on lines +21 to +26

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Consider translating the description to Chinese for consistency.

The section header includes a Chinese translation ("移除所有事件侦听器"), but the description on line 23 remains in English. Most other entries in this file (EventsOn, EventsOnce, EventsOnMultiple, EventsEmit) have Chinese descriptions.

Note: I see that EventsOff (line 17) also has an English description, so this is an existing inconsistency—but it would be good to translate both if time permits.

Suggested translation
 ### EventsOffAll  移除所有事件侦听器

-This method unregisters all event listeners.
+此方法取消注册所有事件侦听器。

 Go: `EventsOffAll(ctx context.Context)`<br/>
 JS: `EventsOffAll()`
🤖 Prompt for AI Agents
In
`@website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/runtime/events.mdx`
around lines 21 - 26, Translate the English description for EventsOffAll to
Chinese to match the header and other entries: replace "This method unregisters
all event listeners." with a concise Chinese sentence (e.g., "此方法注销所有事件侦听器。") in
the EventsOffAll section; while here, also update EventsOff's English
description to a similar Chinese translation for consistency (e.g.,
"此方法注销指定的事件侦听器。") so both EventsOffAll and EventsOff use Chinese descriptions.


### EventsOnce 添加只触发一次的事件侦听器

此方法为给定的事件名称设置一个侦听器,但只会触发一次。 它返回 一个函数来取消侦听器。
Expand Down
1 change: 1 addition & 0 deletions website/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading