chore: strip trailing whitespace (#35969)
This commit is contained in:
parent
dbdbb6fb3b
commit
fd761ec8f7
44 changed files with 91 additions and 94 deletions
|
@ -9,7 +9,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
|
||||
|
||||
<p>Hit any key with this window focused to see it captured here.</p>
|
||||
<div><span>Last Key Pressed: </span><span id="last-keypress"></span></div>
|
||||
<script src="./renderer.js"></script>
|
||||
|
|
|
@ -19,7 +19,7 @@ function createWindow () {
|
|||
// Some APIs can only be used after this event occurs.
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
|
||||
app.on('activate', function () {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<h1>Connection status: <strong id='status'></strong></h1>
|
||||
|
||||
|
||||
<script src="renderer.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -7,14 +7,14 @@ function createWindow () {
|
|||
height: 600,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
mainWindow.webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
|
||||
event.preventDefault()
|
||||
if (deviceList && deviceList.length > 0) {
|
||||
callback(deviceList[0].deviceId)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// Listen for a message from the renderer to get the response for the Bluetooth pairing.
|
||||
|
@ -27,14 +27,14 @@ function createWindow () {
|
|||
bluetoothPinCallback = callback
|
||||
// Send a message to the renderer to prompt the user to confirm the pairing.
|
||||
mainWindow.webContents.send('bluetooth-pairing-request', details)
|
||||
})
|
||||
})
|
||||
|
||||
mainWindow.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
|
|
@ -9,7 +9,7 @@ document.getElementById('clickme').addEventListener('click',testIt)
|
|||
|
||||
window.electronAPI.bluetoothPairingRequest((event, details) => {
|
||||
const response = {}
|
||||
|
||||
|
||||
switch (details.pairingKind) {
|
||||
case 'confirm': {
|
||||
response.confirmed = confirm(`Do you want to connect to device ${details.deviceId}?`)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<h3>HID devices automatically granted access via <i>setDevicePermissionHandler</i></h3>
|
||||
<div id="granted-devices"></div>
|
||||
|
||||
|
||||
<h3>HID devices automatically granted access via <i>select-hid-device</i></h3>
|
||||
<div id="granted-devices2"></div>
|
||||
|
||||
|
|
|
@ -6,16 +6,16 @@ function createWindow () {
|
|||
width: 800,
|
||||
height: 600
|
||||
})
|
||||
|
||||
|
||||
mainWindow.webContents.session.on('select-hid-device', (event, details, callback) => {
|
||||
//Add events to handle devices being added or removed before the callback on
|
||||
//`select-hid-device` is called.
|
||||
mainWindow.webContents.session.on('hid-device-added', (event, device) => {
|
||||
mainWindow.webContents.session.on('hid-device-added', (event, device) => {
|
||||
console.log('hid-device-added FIRED WITH', device)
|
||||
//Optionally update details.deviceList
|
||||
})
|
||||
|
||||
mainWindow.webContents.session.on('hid-device-removed', (event, device) => {
|
||||
|
||||
mainWindow.webContents.session.on('hid-device-removed', (event, device) => {
|
||||
console.log('hid-device-removed FIRED WITH', device)
|
||||
//Optionally update details.deviceList
|
||||
})
|
||||
|
@ -37,13 +37,13 @@ function createWindow () {
|
|||
return true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
mainWindow.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
|
|
@ -6,7 +6,7 @@ function createWindow () {
|
|||
width: 800,
|
||||
height: 600
|
||||
})
|
||||
|
||||
|
||||
mainWindow.webContents.session.on('select-serial-port', (event, portList, webContents, callback) => {
|
||||
|
||||
//Add listeners to handle ports being added or removed before the callback for `select-serial-port`
|
||||
|
@ -15,7 +15,7 @@ function createWindow () {
|
|||
console.log('serial-port-added FIRED WITH', port)
|
||||
//Optionally update portList to add the new port
|
||||
})
|
||||
|
||||
|
||||
mainWindow.webContents.session.on('serial-port-removed', (event, port) => {
|
||||
console.log('serial-port-removed FIRED WITH', port)
|
||||
//Optionally update portList to remove the port
|
||||
|
@ -33,7 +33,7 @@ function createWindow () {
|
|||
if (permission === 'serial' && details.securityOrigin === 'file:///') {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
|
@ -41,10 +41,10 @@ function createWindow () {
|
|||
if (details.deviceType === 'serial' && details.origin === 'file://') {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
|
||||
mainWindow.loadFile('index.html')
|
||||
|
||||
mainWindow.webContents.openDevTools()
|
||||
|
@ -52,7 +52,7 @@ function createWindow () {
|
|||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<h3>USB devices automatically granted access via <i>setDevicePermissionHandler</i></h3>
|
||||
<div id="granted-devices"></div>
|
||||
|
||||
|
||||
<h3>USB devices automatically granted access via <i>select-usb-device</i></h3>
|
||||
<div id="granted-devices2"></div>
|
||||
|
||||
|
|
|
@ -7,17 +7,17 @@ function createWindow () {
|
|||
width: 800,
|
||||
height: 600
|
||||
})
|
||||
|
||||
|
||||
let grantedDeviceThroughPermHandler
|
||||
|
||||
mainWindow.webContents.session.on('select-usb-device', (event, details, callback) => {
|
||||
//Add events to handle devices being added or removed before the callback on
|
||||
//`select-usb-device` is called.
|
||||
mainWindow.webContents.session.on('usb-device-added', (event, device) => {
|
||||
mainWindow.webContents.session.on('usb-device-added', (event, device) => {
|
||||
console.log('usb-device-added FIRED WITH', device)
|
||||
//Optionally update details.deviceList
|
||||
})
|
||||
|
||||
|
||||
mainWindow.webContents.session.on('usb-device-removed', (event, device) => {
|
||||
console.log('usb-device-removed FIRED WITH', device)
|
||||
//Optionally update details.deviceList
|
||||
|
@ -31,7 +31,7 @@ function createWindow () {
|
|||
}
|
||||
})
|
||||
if (deviceToReturn) {
|
||||
callback(deviceToReturn.deviceId)
|
||||
callback(deviceToReturn.deviceId)
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
|
@ -44,10 +44,10 @@ function createWindow () {
|
|||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
mainWindow.webContents.session.setDevicePermissionHandler((details) => {
|
||||
if (details.deviceType === 'usb' && details.origin === 'file://') {
|
||||
if (!grantedDeviceThroughPermHandler) {
|
||||
if (!grantedDeviceThroughPermHandler) {
|
||||
grantedDeviceThroughPermHandler = details.device
|
||||
return true
|
||||
} else {
|
||||
|
@ -55,13 +55,13 @@ function createWindow () {
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
mainWindow.loadFile('index.html')
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
|
|
@ -6,10 +6,10 @@ async function testIt() {
|
|||
const noDevicesFoundMsg = 'No devices found'
|
||||
const grantedDevices = await navigator.usb.getDevices()
|
||||
let grantedDeviceList = ''
|
||||
if (grantedDevices.length > 0) {
|
||||
if (grantedDevices.length > 0) {
|
||||
grantedDevices.forEach(device => {
|
||||
grantedDeviceList += `<hr>${getDeviceDetails(device)}</hr>`
|
||||
})
|
||||
})
|
||||
} else {
|
||||
grantedDeviceList = noDevicesFoundMsg
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ async function testIt() {
|
|||
filters: []
|
||||
})
|
||||
grantedDeviceList += `<hr>${getDeviceDetails(device)}</hr>`
|
||||
|
||||
|
||||
} catch (ex) {
|
||||
if (ex.name === 'NotFoundError') {
|
||||
grantedDeviceList = noDevicesFoundMsg
|
||||
|
|
|
@ -19,7 +19,7 @@ function createWindow () {
|
|||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
|
|
@ -37,7 +37,7 @@ app.whenReady().then(() => {
|
|||
console.log(value) // will print value to Node console
|
||||
})
|
||||
createWindow()
|
||||
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
const exLinksBtn = document.getElementById('open-ex-links')
|
||||
exLinksBtn.addEventListener('click', (event) => {
|
||||
shell.openExternal('https://electronjs.org')
|
||||
})
|
||||
})
|
||||
</code></pre>
|
||||
|
||||
<div class="demo-protip">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<h1>
|
||||
<h1>
|
||||
Open external links and the file manager
|
||||
</h1>
|
||||
<h3>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<p>
|
||||
Electron conveniently allows developers to send notifications with the
|
||||
<a href="https://notifications.spec.whatwg.org/">HTML5 Notification API</a>,
|
||||
<a href="https://notifications.spec.whatwg.org/">HTML5 Notification API</a>,
|
||||
using the currently running operating system’s native notification
|
||||
APIs to display it.
|
||||
</p>
|
||||
|
|
|
@ -27,7 +27,7 @@ ipcMain.handle('clipboard:writeText', (event, text) => {
|
|||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
|
|
@ -31,7 +31,7 @@ ipcMain.handle('clipboard:writeText', (event, text) => {
|
|||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
|
|
@ -23,7 +23,7 @@ if (!gotTheLock) {
|
|||
if (mainWindow.isMinimized()) mainWindow.restore()
|
||||
mainWindow.focus()
|
||||
}
|
||||
|
||||
|
||||
dialog.showErrorBox('Welcome Back', `You arrived from: ${commandLine.pop().slice(0,-1)}`)
|
||||
})
|
||||
|
||||
|
@ -31,7 +31,7 @@ if (!gotTheLock) {
|
|||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
})
|
||||
|
||||
|
||||
app.on('open-url', (event, url) => {
|
||||
dialog.showErrorBox('Welcome Back', `You arrived from: ${url}`)
|
||||
})
|
||||
|
|
|
@ -23,4 +23,4 @@
|
|||
require('./renderer.js')
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
|
@ -10,7 +10,7 @@
|
|||
<i>Supports: Win, macOS, Linux <span>|</span> Process: Main</i>
|
||||
<div>
|
||||
<p>A frameless window is a window that has no <i>"chrome"</i>,
|
||||
such as toolbars, title bars, status bars, borders, etc. You can make
|
||||
such as toolbars, title bars, status bars, borders, etc. You can make
|
||||
a browser window frameless by setting
|
||||
<code>frame</code> to <code>false</code> when creating the window.</p>
|
||||
<div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue