Open mslxl opened 2 months ago
It is not official supported but it should continue the function the same as in v1 like you showed above. With the downside being that what you showed only handle types.
The bigger problem with supporting this is that Tauri's generate_handler
returns a single function which internally dispatches to each of the registered commands. Tauri Specta can't "see inside" that function so we can easily merge mutliple set of commands.
I suspect it might be possible to create a wrapper function to dispatch to multiple inner functions but i've gotta check exactly how Tauri works internlly cause doing so is not really intended and possible not even semver safe.
We should keep this issue though and I will revisit it when I get some time cause we could surely do better.
Also you could possbile look into using Tauri Specta in a plugin as a solution. The plugin and the app can generate different bindings files and Tauri lets them each register their own commands (although the plugin ones will be scoped I think).
In v1, I can use two export statement to export these commands to 2 file:
and then register them in tauri.
But in V2, I noticed the
commands
function ofBuilder
will override old value. Is there any new way to split these exports to multiple file now?