mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-24 13:45:49 +00:00
Restructured Step 0 + 1 to "code along" style
This commit is contained in:
27
content/_code-samples/build-a-wallet/desktop-js/0_hello.js
Normal file
27
content/_code-samples/build-a-wallet/desktop-js/0_hello.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
const { app, BrowserWindow } = require('electron')
|
||||||
|
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is our main function, it creates our application window, preloads the code we will need to communicate
|
||||||
|
* between the renderer Process and the main Process, loads a layout and performs the main logic
|
||||||
|
*/
|
||||||
|
const createWindow = () => {
|
||||||
|
|
||||||
|
// Creates the application window
|
||||||
|
const appWindow = new BrowserWindow({
|
||||||
|
width: 1024,
|
||||||
|
height: 768
|
||||||
|
})
|
||||||
|
|
||||||
|
// Loads a layout
|
||||||
|
appWindow.loadFile(path.join(__dirname, 'view', '0_hello.html'))
|
||||||
|
|
||||||
|
return appWindow
|
||||||
|
}
|
||||||
|
|
||||||
|
// Here we have to wait for the application to signal that it is ready
|
||||||
|
// to execute our code. In this case we just create a main window.
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
})
|
||||||
@@ -44,7 +44,7 @@ const createWindow = () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Loads a layout
|
// Loads a layout
|
||||||
appWindow.loadFile(path.join(__dirname, 'view', '1_hello.html'))
|
appWindow.loadFile(path.join(__dirname, 'view', '1_ledger-index.html'))
|
||||||
|
|
||||||
return appWindow
|
return appWindow
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,8 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"hello": "electron ./1_hello.js",
|
"hello": "electron ./0_hello.js",
|
||||||
|
"ledger-index": "electron ./1_ledger-index.js",
|
||||||
"async-poll": "electron ./2_async-poll.js",
|
"async-poll": "electron ./2_async-poll.js",
|
||||||
"async-subscribe": "electron ./2_async-subscribe.js",
|
"async-subscribe": "electron ./2_async-subscribe.js",
|
||||||
"account": "electron ./3_account.js",
|
"account": "electron ./3_account.js",
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'" />
|
||||||
|
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'" />
|
||||||
|
<title>XRPL Wallet Tutorial (JavaScript / Electron)</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h3>Build a XRPL Wallet - Part 0/8</h3>
|
||||||
|
<span>Hello world!</span>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script src="1_renderer.js"></script>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user