Skip to content

Conversation

@narcilee7
Copy link
Contributor

@narcilee7 narcilee7 commented Jan 17, 2026

Summary

Details

The EventsOffAll function was already implemented in v2/internal/frontend/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 from the JavaScript export.

Changes

Updated 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

Testing

  • Verified that EventsOffAll matches the signature in wrapper runtime files
  • Ensured consistency across all template files
  • Checked that the implementation follows the existing pattern for EventsOff

Fixes #4703

Summary by CodeRabbit

  • New Features
    • Added a runtime method EventsOffAll() across frontend templates to unregister all event listeners in a single call.
  • Documentation
    • Added reference documentation and localized content describing the EventsOffAll API and usage.
  • Changelog
    • Recorded a fix entry noting the missing EventsOffAll in runtime templates and its restoration.

✏️ Tip: You can customize this high-level summary in your review settings.

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 wailsapp#4703

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds a new runtime API function EventsOffAll() across frontend templates and docs: TypeScript declarations and JavaScript wrappers that call window.runtime.EventsOffAll(), plus documentation (English and zh‑Hans) and a changelog entry.

Changes

Cohort / File(s) Summary
Common runtime templates
v2/pkg/templates/generate/assets/common/frontend/wailsjs/runtime/runtime.d.ts, v2/pkg/templates/generate/assets/common/frontend/wailsjs/runtime/runtime.js
Added EventsOffAll() TypeScript declaration and JS export delegating to window.runtime.EventsOffAll()
Framework template variants (TS & JS)
v2/pkg/templates/templates/.../frontend/wailsjs/runtime/runtime.d.ts, v2/pkg/templates/templates/.../frontend/wailsjs/runtime/runtime.js
Added EventsOffAll() declaration and JS wrapper across Lit, Preact, React, Svelte, Vanilla, Vue template variants (both -ts and non--ts)
Documentation
website/docs/reference/runtime/events.mdx, website/i18n/zh-Hans/.../reference/runtime/events.mdx
Added documentation for EventsOffAll (Go and JS signatures) and descriptive text
Changelog
website/src/pages/changelog.mdx
Added Unreleased entry noting fixed missing EventsOffAll in runtime templates

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

runtime, Documentation, size:M, lgtm

Poem

🐇
I hopped through templates, neat and small,
One call to hush and clear them all.
EventsOffAll — a tidy sweep,
Quiet fields where listeners sleep.
A rabbit's nod — the runtime's calm.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding the missing EventsOffAll export to runtime templates.
Description check ✅ Passed The description provides a summary, details about the issue, lists all changed files, and includes testing verification. It matches the template requirements.
Linked Issues check ✅ Passed The PR successfully addresses issue #4703 by implementing EventsOffAll in all runtime templates, matching the signature in wrapper runtime files and ensuring consistency across all framework templates.
Out of Scope Changes check ✅ Passed All changes are directly related to adding the EventsOffAll export to runtime templates. The changelog update appropriately documents the fix with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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 wailsapp#4703

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/runtime/events.mdx`:
- Around line 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.

Comment on lines 21 to 26
### EventsOffAll 移除所有事件侦听器

This method unregisters all event listeners.

Go: `EventsOffAll(ctx context.Context)`<br/>
JS: `EventsOffAll()`
Copy link
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.

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

Related to wailsapp#4703

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@narcilee7
Copy link
Contributor Author

Summary of Changes

This PR addresses issue #4703 by adding the missing EventsOffAll function to the public API templates and documentation.

What was fixed:

  1. Runtime Templates (Commit 1)

    • Added EventsOffAll export to all frontend framework runtime templates
    • Added TypeScript type declarations for EventsOffAll
    • Affected templates: React, Vue, Svelte, Preact, Lit, Vanilla (JS + TS versions)
    • Total: 26 files updated
  2. Documentation (Commit 2)

    • Added EventsOffAll documentation to English runtime events reference
    • Added EventsOffAll documentation to Chinese runtime events reference
    • Included Go and JavaScript function signatures
  3. Changelog (Commit 3)

    • Added entry to Unreleased section noting the fix

Root Cause:

The EventsOffAll function was already implemented in:

  • v2/pkg/runtime/events.go (Go implementation)
  • v2/internal/frontend/runtime/desktop/events.js (JavaScript implementation)
  • v2/internal/frontend/runtime/wrapper/runtime.js & .d.ts (Internal wrapper)

However, it was missing from the public-facing templates that are generated in user projects (v2/pkg/templates/), causing a type mismatch where the TypeScript declaration existed but the implementation was missing.

Testing:

  • Verified the implementation matches the existing EventsOff pattern
  • Ensured consistency across all 26 template files
  • Confirmed documentation includes both Go and JavaScript signatures

Fixes #4703

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@website/src/pages/changelog.mdx`:
- Line 19: The changelog entry text "Fixed missing `EventsOffAll` in runtime
templates for all frontend frameworks
[`#4703`](https://github.com/wailsapp/wails/pull/4883) by `@narcilee7`" has a
mismatched issue/PR label and URL; update the bracketed label or the link so
they match (e.g., change "[`#4703`]" to "[`#4883`]" to match the current URL, or
change the URL to "/pull/4703"), or include both numbers like
"[`#4703/`#4883](...)"; locate the exact string in the changelog.mdx entry for the
change and modify the label or URL accordingly while preserving the rest of the
sentence and author attribution.

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

Related to wailsapp#4703

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@narcilee7 narcilee7 force-pushed the fix/EventsOffAll-missing-in-runtime-templates branch from 31bf2f4 to b376c17 Compare January 17, 2026 19:34
@leaanthony
Copy link
Member

Thank you!!

@leaanthony leaanthony merged commit 4e8b705 into wailsapp:master Jan 25, 2026
9 of 12 checks passed
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
100.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No EventOffAll implementation in runtime.js but a declaration in runtime.d.ts

2 participants