随笔分类 - electron
摘要:electron 开启本地http服务,让第三方可以直接通过webapi的方式访问 1、新建server.js 1 const os = require('os'); 2 const http = require('http'); 3 4 5 let server; 6 7 function ope
阅读全文
摘要:在electron里面运行的页面,异常请求的时候,发生跨域问题。在普通浏览器上正常运行。解决办法: 在webPreferences上添加webSecurity: false webPreferences:{ webSecurity: false }, 同时在文件的最顶端添加: app.command
阅读全文
摘要:Electron因为开启了node集成才能实现和网页的通信,引入jQuery较高版本它的模块化定义(基于CommonJS)和Electron的内部机制冲突了。目前提供以下两个方案: 1、使用jQuery 1.8.2版本,更高版本还没有测试。 2、添加下面的代码以后,再引入jQuery的高版本。注意前
阅读全文
摘要:electron 报@electron/remote is disabled for this WebContents. Call require("@electron/remote/main").enable(webContents) to enable it. 在创建窗口地方加上这句: requ
阅读全文
摘要:electron 报 Fatal error in V8: v8_ArrayBuffer_NewBackingStore When the V8 Sandbox is enabled, ArrayBuffer backing stores must be allocated inside the s
阅读全文
摘要:1、Uncaught Error: Dynamic Linking Error: Win32 error 126 DLL引用的路径错误,检查下DLL的路径是否正确 2、Uncaught Error: Dynamic Linking Error: Win32 error 193 DLL位数不对,根据系
阅读全文
摘要:环境:"electron": "^22.0.0"、麒麟系统V10(sp1) 1、思路:利用nodejs调linux的打印命令lp打印 2、代码: const childProcess = require("child_process"); const sp = childProcess.exec('
阅读全文
摘要:1、主进程代码 1 let electron = require('electron') 2 const {ipcMain,BrowserWindow} = require('electron') 3 4 let app = electron.app //引用APP 5 let mainWindow
阅读全文
摘要:环境: "devDependencies": { "electron": "^22.0.0" }, "dependencies": { "@electron/remote": "^2.0.9", "log4js": "^6.7.1" } 1、安装: npm install log4js --save
阅读全文
摘要:写了个脚本,导出的时候报SyntaxError: Unexpected token 'export' 查一下发现是Node的导入导出规范跟浏览器ES6不太一样 将导出由 export{ xxx } 改成 module.exports = { xxx } 就可以
阅读全文
摘要:1、安装electron-packager // 全局安装 npm install -g electron-packager // 项目安装 npm install electron-packager -D 2、在package.json添直执脚本 "scripts": { "test": "ech
阅读全文
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="wi
阅读全文
摘要:一、知识点: global-shortcut 模块可以便捷的为您设置(注册/注销)各种自定义操作的快捷键. Note: 使用此模块注册的快捷键是系统全局的(QQ截图那种), 不要在应用模块(app module)响应 ready 消息前使用此模块(注册快捷键). Methods global-sho
阅读全文
摘要:一、知识点 在渲染进程中, Online and offline 事件检测,是通过标准 HTML5 API 中 navigator.onLine 属性来实现的。 脱机时 (从网络断开), navigator.onLine 属性将返回 false, 除此之外都返回true 。 由于所有其他条件都返回
阅读全文
摘要:一、知识点 dialog.showErrorBox(title, content) 展示一个传统的包含错误信息的对话框. + 在 app 模块触发 ready 事件之前,这个 api 可以被安全调用,通常它被用来在启动的早期阶段报告错误. 在 Linux 上,如果在 app 模块触发 ready 事
阅读全文
摘要:一、知识点 dialog.showMessageBox([browserWindow, ]options[, callback]) browserWindow BrowserWindow (可选) options Object type String - 可以是 "none", "info", "e
阅读全文
摘要:一、知识点 dialog.showSaveDialog([browserWindow, ]options[, callback]) browserWindow BrowserWindow (可选) options Object title String defaultPath String filt
阅读全文
摘要:知识点: dialog.showOpenDialog([browserWindow, ]options[, callback]) browserWindow BrowserWindow (可选) options Object title String defaultPath String filte
阅读全文
摘要:主要用到了js 里面的 window.opener.postMessage(); 在html页可以直接运行,跟electron没有直接关系 1、新建父窗口页“06父窗口接收子窗口.html” 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta
阅读全文
摘要:1、新建渲染进程 “嵌入网页.htm” <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="v
阅读全文