Open
Description
Electron fiddle already has lots of great examples for using different electron apis. I'm thinking a protocol api example could be a useful addition to the Electron fiddle examples.
Based on the electron documentation, this is how the example could look like:
const { app, BrowserWindow, protocol } = require('electron')
function createWindow () {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {}
})
mainWindow.loadURL('some-protocol://index.html')
}
app.whenReady().then(() => {
protocol.handle('some-protocol', () => {
return new Response(
Buffer.from('<h1>Hello from protocol handler</h1>'), // Could also be a string or ReadableStream.
{ headers: { 'content-type': 'text/html' } }
);
});
createWindow()
})
Metadata
Metadata
Assignees
Labels
No labels