chore: move window.open to platform io to handle desktop app
This commit is contained in:
@@ -81,4 +81,11 @@ export type IOPlatformDef = {
|
||||
saveFileWithDialog: (
|
||||
opts: SaveFileWithDialogOptions
|
||||
) => Promise<SaveFileResponse>
|
||||
|
||||
/**
|
||||
* Opens a link in the user's browser.
|
||||
* The expected behaviour is for the browser to open a new tab/window (for example in desktop app) with the given URL.
|
||||
* @param url The URL to open
|
||||
*/
|
||||
openExternalLink: (url: string) => Promise<void>
|
||||
}
|
||||
|
||||
@@ -34,4 +34,10 @@ export const browserIODef: IOPlatformDef = {
|
||||
// Browsers provide no way for us to know the save went successfully.
|
||||
return Promise.resolve({ type: "unknown" })
|
||||
},
|
||||
openExternalLink(url) {
|
||||
window.open(url, "_blank")
|
||||
|
||||
// Browsers provide no way for us to know the open went successfully.
|
||||
return Promise.resolve()
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user