New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): add IPC channel #6813
Merged
Merged
Changes from 9 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
cfed95a
feat(core): add IPC channel
lucasfernog 6737c68
simplify code
lucasfernog c4f7c14
add iOS impl
lucasfernog c578b17
impl serialize for channel
lucasfernog f6a0907
add change file
lucasfernog f5f3174
Merge remote-tracking branch 'origin/next' into feat/channel
lucasfernog 2a19f01
revert callback/error cleanup removal
lucasfernog cffd9ce
Merge branch 'next' into feat/channel
lucasfernog c71f4fa
return class instead of string [skip ci]
lucasfernog 1cf7f9a
cut string at prefix instead of using split
lucasfernog a40e9cd
add type
lucasfernog 088e049
add headers
lucasfernog 40a8422
Merge branch 'next' into feat/channel
lucasfernog d7c0552
fix: ios build
lucasfernog 8a5240a
Merge branch 'next' into feat/channel
lucasfernog 3ea4892
Merge remote-tracking branch 'origin/next' into feat/channel
lucasfernog 36cb3bf
split_once
lucasfernog b435550
remove channel function, expose class
lucasfernog 2ee8303
change channel API, add onmessage property
lucasfernog 4d28f04
lint
lucasfernog 6359fc9
fix ci
lucasfernog 0da8170
Merge remote-tracking branch 'origin/next' into feat/channel
lucasfernog 75e735d
fix impl on isolation pattern
lucasfernog 823ac0a
fmt
lucasfernog 9122e27
update example [skip ci]
lucasfernog File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"api": patch | ||
"tauri": patch | ||
--- | ||
|
||
Add channel API for sending data across the IPC. |
7 changes: 7 additions & 0 deletions
7
core/tauri/mobile/android/src/main/java/app/tauri/plugin/Channel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package app.tauri.plugin | ||
|
||
class Channel(val id: Long, private val handler: (data: JSObject) -> Unit) { | ||
fun send(data: JSObject) { | ||
handler(data) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
public class Channel { | ||
var callback: UInt64 | ||
var handler: (JsonValue) -> Void | ||
|
||
public init(callback: UInt64, handler: @escaping (JsonValue) -> Void) { | ||
self.callback = callback | ||
self.handler = handler | ||
} | ||
|
||
public func send(_ data: JsonObject) { | ||
handler(.dictionary(data)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would refactor this to be more similar to the
Websocket
orBroadcastChannel
api i.e. the constructor takes no arguments and you can listen to events by overriding theon message
property or calling.addEventListener('message', () => {})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, pushed.