Having upgraded to Electron 7.0, I've noticed this deprecation message:
(node:8308) ProtocolDeprecateCallback: The callback argument of protocol module APIs is no longer needed.
The code in question is:
await new Promise((resolve, reject) => {
electron.protocol.registerBufferProtocol(MY_PROTOCOL,
(request, callback) => {
const uri = request.url;
if (uri) {
callback({ mimeType: 'text/plain', data: Buffer.from(uri) });
}
else {
callback({ error: -324 }); // EMPTY_RESPONSE
}
},
error => error? reject(error): resolve()
);
});
What's the proper way of calling registerBufferProtocol now, as of Electron 7?