mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
chore: lint code blocks in docs with ESLint (#42113)
This commit is contained in:
@@ -9,6 +9,7 @@ An example of implementing a protocol that has the same effect as the
|
||||
|
||||
```js
|
||||
const { app, protocol, net } = require('electron')
|
||||
|
||||
const path = require('node:path')
|
||||
const url = require('node:url')
|
||||
|
||||
@@ -38,8 +39,9 @@ to register it to that session explicitly.
|
||||
|
||||
```js
|
||||
const { app, BrowserWindow, net, protocol, session } = require('electron')
|
||||
|
||||
const path = require('node:path')
|
||||
const url = require('url')
|
||||
const url = require('node:url')
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const partition = 'persist:example'
|
||||
@@ -76,6 +78,7 @@ Policy:
|
||||
|
||||
```js
|
||||
const { protocol } = require('electron')
|
||||
|
||||
protocol.registerSchemesAsPrivileged([
|
||||
{ scheme: 'foo', privileges: { bypassCSP: true } }
|
||||
])
|
||||
@@ -128,8 +131,9 @@ Example:
|
||||
|
||||
```js
|
||||
const { app, net, protocol } = require('electron')
|
||||
|
||||
const path = require('node:path')
|
||||
const { pathToFileURL } = require('url')
|
||||
const { pathToFileURL } = require('node:url')
|
||||
|
||||
protocol.registerSchemesAsPrivileged([
|
||||
{
|
||||
@@ -330,7 +334,8 @@ Example:
|
||||
|
||||
```js
|
||||
const { protocol } = require('electron')
|
||||
const { PassThrough } = require('stream')
|
||||
|
||||
const { PassThrough } = require('node:stream')
|
||||
|
||||
function createStream (text) {
|
||||
const rv = new PassThrough() // PassThrough is also a Readable stream
|
||||
|
||||
Reference in New Issue
Block a user