diff --git a/content/_code-samples/build-a-wallet/desktop-js/README.md b/content/_code-samples/build-a-wallet/desktop-js/README.md index 3e7245acd6..1e7037d253 100644 --- a/content/_code-samples/build-a-wallet/desktop-js/README.md +++ b/content/_code-samples/build-a-wallet/desktop-js/README.md @@ -1,4 +1,4 @@ -# Build a Wallet Sample Code (JavaScript) [WIP] +# Build a Desktop Wallet Sample Code (JavaScript) This folder contains sample code for a non-custodial XRP Ledger wallet application in JavaScript. For the full documentation, refer to the [Build a Wallet in JavaScript tutorial](build-a-wallet-in-javascript.html). diff --git a/content/tutorials/build-apps/build-a-desktop-wallet-in-javascript.md b/content/tutorials/build-apps/build-a-desktop-wallet-in-javascript.md index ed75c99bc2..06c9832429 100644 --- a/content/tutorials/build-apps/build-a-desktop-wallet-in-javascript.md +++ b/content/tutorials/build-apps/build-a-desktop-wallet-in-javascript.md @@ -58,7 +58,7 @@ In addition to the above features, you'll also learn a bit about Events, IPC (in ### 0. Project setup - Hello World -1. To initialize the project, create a package.json file with the following content: +1. To initialize the project, create a file named `package.json` with the following content: ```json { @@ -243,14 +243,14 @@ This helper function does the following: It establishes a WebSocket connection t }) ``` -3. Now in the `view` folder, create a file `preload.js`with the following content: +3. Now in the `view` folder, create a file `preload.js` with the following content: ```javascript const { contextBridge, ipcRenderer } = require('electron'); // Expose functionality from main process (aka. "backend") to be used by the renderer process(aka. "backend") contextBridge.exposeInMainWorld('electronAPI', { - // By calling "onUpdateLedgerIndex" in the frontend process we can now attach a callback function to + // By calling "onUpdateLedgerIndex" in the frontend process we can now attach a callback function // by making onUpdateLedgerIndex available at the window level. // The subscribed function gets triggered whenever the backend process triggers the event 'update-ledger-index' onUpdateLedgerIndex: (callback) => { @@ -259,7 +259,7 @@ contextBridge.exposeInMainWorld('electronAPI', { }) ``` -This preloader script is used to expose functions to the browsers window object which can be used to subscribe frontend logic to events broadcast from the main logic in `index.js`. +This preloader script is used to expose functions to the browser's window object, so that the user interface can react to events broadcast from the main logic in `index.js`. In the browser, `window.electronAPI.onUpdateLedgerIndex(callback)` can now be used to pass a callback function via `ipcRenderer.on('eventName', callback)` that will be triggered by `appWindow.webContents.send('eventName', value)`. @@ -321,8 +321,8 @@ This example shows how to do Inter Process Communication (IPC) in Electron. Tech 1. We started by creating a function that enables the frontend to subscribe to backend events via the `ContextBridge` (`onUpdateLedgerIndex` in `view/preload.js`) 2. Then we make the function available by putting it in a preloader script to ensure it is loaded and can be used by the frontend. -3. On the frontend, we can then use that function to attach a callback that handles frontend updates when the event is dispatched. We could do this in the console, in a `