use new Buffer.from
This commit is contained in:
parent
18dec9c39c
commit
3d2c622ba7
4 changed files with 4 additions and 4 deletions
|
@ -76,7 +76,7 @@ app.on('ready', function () {
|
|||
|
||||
```javascript
|
||||
protocol.registerBufferProtocol('atom', function (request, callback) {
|
||||
callback({mimeType: 'text/html', data: new Buffer('<h5>Response</h5>')})
|
||||
callback({mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>')})
|
||||
}, function (error) {
|
||||
if (error) console.error('Failed to register protocol')
|
||||
})
|
||||
|
|
|
@ -130,7 +130,7 @@ app.on('ready', () => {
|
|||
const {protocol} = require('electron')
|
||||
|
||||
protocol.registerBufferProtocol('atom', (request, callback) => {
|
||||
callback({mimeType: 'text/html', data: new Buffer('<h5>Response</h5>')})
|
||||
callback({mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>')})
|
||||
}, (error) => {
|
||||
if (error) console.error('Failed to register protocol')
|
||||
})
|
||||
|
|
|
@ -124,7 +124,7 @@ app.on('ready', () => {
|
|||
const {protocol} = require('electron')
|
||||
|
||||
protocol.registerBufferProtocol('atom', (request, callback) => {
|
||||
callback({mimeType: 'text/html', data: new Buffer('<h5>Response</h5>')})
|
||||
callback({mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>')})
|
||||
}, (error) => {
|
||||
if (error) console.error('Failed to register protocol')
|
||||
})
|
||||
|
|
|
@ -137,7 +137,7 @@ Example:
|
|||
const {protocol} = require('electron')
|
||||
|
||||
protocol.registerBufferProtocol('atom', (request, callback) => {
|
||||
callback({mimeType: 'text/html', data: new Buffer('<h5>Response</h5>')})
|
||||
callback({mimeType: 'text/html', data: Buffer.from('<h5>Response</h5>')})
|
||||
}, (error) => {
|
||||
if (error) console.error('Failed to register protocol')
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue