electron

How to share state (react)between electron's multiple windows?

我怕爱的太早我们不能终老 提交于 2020-08-25 07:31:20
问题 I am developing a desktop app with react for UI and electron. So, for now, I am fetching data from the server and saving it in the state using React's Context API to update the UI. I am keeping the state and the function to add, remove and update state in the renderer process and with IPC I am sharing the data between renderer process through main process (as it should be). But as the application is scaling I need a better approach. Something like a central state (if that's a thing). P.S. can

How to use puppeteer-core with electron?

左心房为你撑大大i 提交于 2020-08-24 03:12:18
问题 I got this code from another Stackoverflow Question: import electron from "electron"; import puppeteer from "puppeteer-core"; const delay = (ms: number) => new Promise(resolve => { setTimeout(() => { resolve(); }, ms); }); (async () => { try { const app = await puppeteer.launch({ executablePath: electron, args: ["."], headless: false, }); const pages = await app.pages(); const [page] = pages; await page.setViewport({ width: 1200, height: 700 }); await delay(5000); const image = await page

一个开源的跨平台音乐播放与音乐下载器

这一生的挚爱 提交于 2020-08-19 20:54:12
跨平台的音乐播放器 目前国内的linux平台上的音乐播放器不多,除了网易云比较多人使用的。 当然 Listen1 也是一个不错的选择,真正的跨平台,包括Android/Mac/Win/Linux以及Chrome插件,目前尚在维护: Listen1其实非常不错,支持歌单功能,可以方便的播放,但美中不足的是没有下载功能。 因此,这里推荐一个带下载以及播放功能的开源音乐软件: 洛雪音乐助手桌面版 。 一个基于 Electron + Vue 开发的音乐软件。 UI: 推荐歌单列表: 排行榜: 下载功能: 来源: oschina 链接: https://my.oschina.net/u/4231975/blog/4298210

How to find if electron app is in foreground?

一笑奈何 提交于 2020-08-19 17:06:35
问题 I have a requirement where I want to perform an action inside the electron app only when it is in foreground. It is an electron-react application. On mounting of a component, I want to schedule a periodic task which only runs when the app is in focus or is being used by the user. And pause the task when the app goes in background. How can we detect the Electron app being in foreground? 回答1: You can use the isFocused method from BrowserWindow. To get your own BrowserWindow, you can do this :

How to find if electron app is in foreground?

佐手、 提交于 2020-08-19 17:06:02
问题 I have a requirement where I want to perform an action inside the electron app only when it is in foreground. It is an electron-react application. On mounting of a component, I want to schedule a periodic task which only runs when the app is in focus or is being used by the user. And pause the task when the app goes in background. How can we detect the Electron app being in foreground? 回答1: You can use the isFocused method from BrowserWindow. To get your own BrowserWindow, you can do this :

How to find if electron app is in foreground?

﹥>﹥吖頭↗ 提交于 2020-08-19 17:05:54
问题 I have a requirement where I want to perform an action inside the electron app only when it is in foreground. It is an electron-react application. On mounting of a component, I want to schedule a periodic task which only runs when the app is in focus or is being used by the user. And pause the task when the app goes in background. How can we detect the Electron app being in foreground? 回答1: You can use the isFocused method from BrowserWindow. To get your own BrowserWindow, you can do this :

Full text search in Electron BrowserWindow

坚强是说给别人听的谎言 提交于 2020-08-19 11:32:29
问题 Does the Electron application framework have built-in text search? The quick-start application doesn't provide any apparent search functionality (e.g. using Ctrl-F or from the menu options). I would have expected this to be a BrowserWindow option (or an option of its WebContents), but I don't see anything helpful in the docs. 回答1: Try webContents.findInPage just added in the latest version. 回答2: I know this is an old thread, but might still be relevant for people out there. Had the same

electron 源码构建 linux

北城余情 提交于 2020-08-18 21:18:41
https://www.electronjs.org/docs/development/build-instructions-linux 构建步骤 (Linux) 遵循下面的准则在 Linux 上创建 Electron 。 EN 基本要求 至少 25GB 硬盘空间 和 8GB 内存. Python 2.7.x. 一些发行版如 CentOS 6.x 仍然使用 Python 2.6.x ,所以或许需要 check 你的 Python 版本,使用 python -V . 请确保您的系统和Python的版本至少支持TLS 1.2。 您可以运行下面这个脚本来测试: $ npx @electron/check-python-tls 复制 如果脚本反映你的设置使用过时的安全协议,请用系统的软件包管理器更新Python在2.7.x中的最高版本。 或者,您也可以访问ttps:// www.python.org/downloads/,以获取更加详细的指导信息。 Node.js. 有多种方法安装 Node.js。 您可以从 Nodejs.org 下载源代码并进行编译。 也可以作为一个标准的用户在 home 目录下安装 node. 或者尝试使用 NodeSource 仓库 clang 3.4 或更高版本。 Development headers of GTK 3 and libnotify. 在

用 JavaScript 运行上世纪 90 年代的 Mac OS 8 | Linux 中国

杀马特。学长 韩版系。学妹 提交于 2020-08-17 16:14:09
如果你想重温或看看上世纪 90 年代末使用的 Mac 是什么样子,那么现在有个机会。 作者:硬核老王 (本文字数:916,阅读时长大约:1 分钟) 如果你想重温或看看上世纪 90 年代使用的 Mac 是什么样子,那么现在有个机会。Slack 开发者 Felix Rieseberg 将 Mac OS 8 改造成了一个可以安装在 Mac 或 PC 上的 Electron 应用。 继 2018 年将 Windows 95 转化为应用 后,Rieseberg 决定将 1991 年的 Macintosh Quadra 与 Mac OS 8.1 整个转化为一个 Electron 应用。该应用可以安装在 macOS、Windows 和 Linux 上。 它收录了一张 1997 年的 MacWorld 演示光盘中的许多游戏和应用的演示版,这包括《毁灭公爵 3D版》、《文明 2》、《龙与地下城》、《Namely》、《俄勒冈之路》、《Alley 19 Bowling》和《Damage Incorporated》等经典游戏,还有一些应用程序,如 Photoshop 3、Premiere 4、Illustrator 5.5、StuffIt 解压软件等等。 这个应用使用一个虚拟机来模拟 Macintosh Quadra 900,其 CPU 是苹果在过渡到 IBM 的 PowerPC 芯片之前使用的摩托罗拉

用 JavaScript 运行上世纪 90 年代的 Mac OS 8

时光总嘲笑我的痴心妄想 提交于 2020-08-14 22:42:29
如果你想重温或看看上世纪 90 年代使用的 Mac 是什么样子,那么现在有个机会。Slack 开发者 Felix Rieseberg 将 Mac OS 8 改造成了一个可以安装在 Mac 或 PC 上的 Electron 应用。 继 2018 年将 Windows 95 转化为应用 后,Rieseberg 决定将 1991 年的 Macintosh Quadra 与 Mac OS 8.1 整个转化为一个 Electron 应用。该应用可以安装在 macOS、Windows 和 Linux 上。 它收录了一张 1997 年的 MacWorld 演示光盘中的许多游戏和应用的演示版,这包括《毁灭公爵 3D版》、《文明 2》、《龙与地下城》、《Namely》、《俄勒冈之路》、《Alley 19 Bowling》和《Damage Incorporated》等经典游戏,还有一些应用程序,如 Photoshop 3、Premiere 4、Illustrator 5.5、StuffIt 解压软件等等。 这个应用使用一个虚拟机来模拟 Macintosh Quadra 900,其 CPU 是苹果在过渡到 IBM 的 PowerPC 芯片之前使用的摩托罗拉 CPU。 Rieseberg 说,他是使用 JavaScript 编写的 Electron 应用,虽然效果看起来还可以,但是不要有过高的期望