Conversation
I've also implemented it for desktop (it can easily be backported to v1) though the main idea here is to use it to send events from the Kotlin and Swift sides to the webview (eventually we'll also need a communication channel between mobile and Rust, but that's a little complicated since it involves static variables). |
|
Is this part of the public API? |
|
Yeah it is part of the public API @JonasKruckenberg |
chippers
left a comment
There was a problem hiding this comment.
I'm not fully up to date with mobile, but I see what you are trying to do with the channel communication here.
Only suggestion would be to cut the channel prefix once, instead of splitting on the string and grabbing the second.
|
Can we hold off on merging this until I had the chance to review it tomorrow? |
|
Sure @JonasKruckenberg |
core/tauri/src/api/ipc.rs
Outdated
| if value.starts_with(CHANNEL_PREFIX) { | ||
| let callback_id: Option<usize> = value | ||
| .chars() | ||
| .skip(CHANNEL_PREFIX.len()) | ||
| .collect::<String>() | ||
| .parse() | ||
| .ok(); |
There was a problem hiding this comment.
Maybe use value.split_once(CHANNEL_PREFIX)
tooling/api/src/tauri.ts
Outdated
| return identifier | ||
| } | ||
|
|
||
| class Channel { |
There was a problem hiding this comment.
I would refactor this to be more similar to the Websocket or BroadcastChannel api i.e. the constructor takes no arguments and you can listen to events by overriding the on message property or calling .addEventListener('message', () => {})
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Checklist
fix: remove a typo, closes #___, #___)Other information