FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node-usb-example-electron/preload.js at main · node-usb/node-usb-example-electron · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
node-usb
/
node-usb-example-electron
Public
Notifications
You must be signed in to change notification settings
Fork
12
Star
35
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
node-usb-example-electron
/
preload.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
16 lines (13 loc) · 595 Bytes
Breadcrumbs
node-usb-example-electron
/
preload.js
Copy path
File metadata and controls
16 lines (13 loc) · 595 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const
{
ipcRenderer
}
=
require
(
'electron'
)
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
window
.
addEventListener
(
'DOMContentLoaded'
,
(
)
=>
{
const
replaceText
=
(
selector
,
text
)
=>
{
const
element
=
document
.
getElementById
(
selector
)
if
(
element
)
element
.
innerText
=
text
}
for
(
const
dependency
of
[
'chrome'
,
'node'
,
'electron'
]
)
{
replaceText
(
`
${
dependency
}
-version`
,
process
.
versions
[
dependency
]
)
}
ipcRenderer
.
on
(
'devices'
,
(
_event
,
text
)
=>
replaceText
(
'devices'
,
text
)
)
}
)
Back
|
FazBrowse Home
|
New Git URL