Repository navigation
Replies: 1 comment 1 reply
|
Thanks for the suggestion @N7ghtm4r3! I'd rather not add an You can get the same result with a small // commonMain
expect suspend fun openFile(file: PlatformFile)
// nonWebMain (Android, iOS, JVM, macOS…)
actual suspend fun openFile(file: PlatformFile) {
FileKit.openFileWithDefaultApplication(file)
}
// webMain (JS + Wasm)
actual suspend fun openFile(file: PlatformFile) {
FileKit.download(file) // or any web-specific behavior you prefer
}Then call I'm keeping the idea of a real web implementation in mind, for example opening the file in a new browser tab. If more people need it, feel free to upvote this discussion! |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi @vinceglb!
Could be a way to avoid each time to create a custom expect/actual implementation to wrap the missing behavior of
openFileWithDefaultApplicationon the web target create an internal wrapper oncommonMainwith aonWebarg to eventually perform an alternative action if invoked by a webapp?For example:
openFileWithDefaultApplicationWrapper( onWeb: ((PlatformFile) -> Unit)? = null )All reactions