electron/spec/fixtures/api/custom-protocol-shutdown.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
539 B
JavaScript
Raw Normal View History

const { app, webContents, protocol, session } = require('electron');
protocol.registerSchemesAsPrivileged([
{ scheme: 'test', privileges: { standard: true, secure: true } }
]);
app.whenReady().then(function () {
const ses = session.fromPartition('persist:test-standard-shutdown');
const web = webContents.create({ session: ses });
ses.protocol.registerStringProtocol('test', (request, callback) => {
callback('Hello World!');
});
2020-07-06 17:50:03 +00:00
web.loadURL('test://abc/hello.txt');
2020-07-06 17:50:03 +00:00
web.on('did-finish-load', () => app.quit());
});