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
5 changes: 5 additions & 0 deletions .changes/add-plugin-listener-error-handling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tauri-apps/api": patch:bug
---

Fix `addPluginListener` fallback added in https://github.com/tauri-apps/tauri/pull/14132 didn't work properly
2 changes: 1 addition & 1 deletion crates/tauri/scripts/bundle.global.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions packages/api/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,16 @@ async function addPluginListener<T>(
): Promise<PluginListener> {
const handler = new Channel<T>(cb)
try {
return invoke(`plugin:${plugin}|register_listener`, {
await invoke(`plugin:${plugin}|register_listener`, {
event,
handler
}).then(() => new PluginListener(plugin, event, handler.id))
})
return new PluginListener(plugin, event, handler.id)
} catch {
// TODO(v3): remove this fallback
// note: we must try with camelCase here for backwards compatibility
return invoke(`plugin:${plugin}|registerListener`, { event, handler }).then(
() => new PluginListener(plugin, event, handler.id)
)
await invoke(`plugin:${plugin}|registerListener`, { event, handler })
return new PluginListener(plugin, event, handler.id)
}
}

Expand Down
Loading