From e991c1868e301fab1fa9c160cc1317a47a468e8c Mon Sep 17 00:00:00 2001 From: Sergei Chestakov Date: Mon, 3 Jul 2023 04:30:45 -0400 Subject: [PATCH] docs: fix misleading code sample for handling deeplinks on Linux (#38862) Fix misleading docs for handling deeplinks in Linux --- docs/tutorial/launch-app-from-url-in-another-app.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/tutorial/launch-app-from-url-in-another-app.md b/docs/tutorial/launch-app-from-url-in-another-app.md index 4fe2212d040..d3868583481 100644 --- a/docs/tutorial/launch-app-from-url-in-another-app.md +++ b/docs/tutorial/launch-app-from-url-in-another-app.md @@ -63,9 +63,9 @@ const createWindow = () => { In this next step, we will create our `BrowserWindow` and tell our application how to handle an event in which an external protocol is clicked. -This code will be different in Windows compared to MacOS and Linux. This is due to Windows requiring additional code in order to open the contents of the protocol link within the same Electron instance. Read more about this [here](../api/app.md#apprequestsingleinstancelockadditionaldata). +This code will be different in Windows and Linux compared to MacOS. This is due to both platforms emitting the `second-instance` event rather than the `open-url` event and Windows requiring additional code in order to open the contents of the protocol link within the same Electron instance. Read more about this [here](../api/app.md#apprequestsingleinstancelockadditionaldata). -#### Windows code: +#### Windows and Linux code: ```javascript @ts-type={mainWindow:Electron.BrowserWindow} @ts-type={createWindow:()=>void} const gotTheLock = app.requestSingleInstanceLock() @@ -80,8 +80,7 @@ if (!gotTheLock) { mainWindow.focus() } // the commandLine is array of strings in which last element is deep link url - // the url str ends with / - dialog.showErrorBox('Welcome Back', `You arrived from: ${commandLine.pop().slice(0, -1)}`) + dialog.showErrorBox('Welcome Back', `You arrived from: ${commandLine.pop()}`) }) // Create mainWindow, load the rest of the app, etc... @@ -91,7 +90,7 @@ if (!gotTheLock) { } ``` -#### MacOS and Linux code: +#### MacOS code: ```javascript @ts-type={createWindow:()=>void} // This method will be called when Electron has finished