多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ## 方法 ``` protocol.registerStandardSchemes(schemes) protocol.registerServiceWorkerSchemes(schemes) protocol.registerFileProtocol(scheme, handler[, completion]) protocol.registerStringProtocol(scheme, handler[, completion]) protocol.registerHttpProtocol(scheme, handler[, completion]) protocol.unregisterProtocol(scheme[, completion]) protocol.interceptFileProtocol(scheme, handler[, completion]) protocol.interceptStringProtocol(scheme, handler[, completion]) protocol.interceptBufferProtocol(scheme, handler[, completion]) protocol.interceptHttpProtocol(scheme, handler[, completion]) protocol.uninterceptProtocol(scheme[, completion]) ``` ## 例子 ``` const {app} = require('electron'); const path =require('path'); if (!app) return; if (process.defaultApp) { if (process.argv.length >= 2) { app.setAsDefaultProtocolClient('electron-demo', process.execPath, [path.resolve(process.argv[1])]) } } else { app.setAsDefaultProtocolClient('electron-demo') } ```