electron

Electron require() is not defined

寵の児 提交于 2019-12-17 08:53:31
问题 I'm creating an Electron app for my own purpose. My problem is when I'm using node functions inside my HTML page it throws an error of: 'require()' is not defined. Is there any way to use Node functionalities in all my HTML pages? If it is possible please give me an example of how to do this or provide a link. Here are the variables I'm trying to use in my HTML page: var app = require('electron').remote; var dialog = app.dialog; var fs = require('fs'); and these are the values I'm using in

Electron require() is not defined

眉间皱痕 提交于 2019-12-17 08:53:01
问题 I'm creating an Electron app for my own purpose. My problem is when I'm using node functions inside my HTML page it throws an error of: 'require()' is not defined. Is there any way to use Node functionalities in all my HTML pages? If it is possible please give me an example of how to do this or provide a link. Here are the variables I'm trying to use in my HTML page: var app = require('electron').remote; var dialog = app.dialog; var fs = require('fs'); and these are the values I'm using in

NPM run * doesn't do anything

你。 提交于 2019-12-17 06:54:15
问题 I was running an Electron project, and everything worked just fine. But now when I run any of the scripts in my package.json (including npm start), it just escapes a line and doesn't do anything. My package.json: { "name": "interclip-desktop", "version": "0.0.7", "description": "Interclip for desktop", "repository": "https://github.com/aperta-principium/Interclip-desktop", "main": "main.js", "scripts": { "start": "electron .", "package-mac": "electron-packager . --overwrite --asar=true -

NPM run * doesn't do anything

痴心易碎 提交于 2019-12-17 06:53:33
问题 I was running an Electron project, and everything worked just fine. But now when I run any of the scripts in my package.json (including npm start), it just escapes a line and doesn't do anything. My package.json: { "name": "interclip-desktop", "version": "0.0.7", "description": "Interclip for desktop", "repository": "https://github.com/aperta-principium/Interclip-desktop", "main": "main.js", "scripts": { "start": "electron .", "package-mac": "electron-packager . --overwrite --asar=true -

How to access DOM elements in electron?

柔情痞子 提交于 2019-12-17 04:54:25
问题 I am trying to add functionality to a button in index.html file is as follows: I have a button element in index.html <button id="auth-button">Authorize</button> In main.js of the app, I have require('crash-reporter').start(); console.log("oh yaeh!"); var mainWindow = null; app.on('window-all-closed', function(){ if(process.platform != 'darwin'){ app.quit(); } }); app.on('ready',function(){ mainWindow = new BrowserWindow({width:800, height : 600}); mainWindow.loadUrl('file://' + __dirname + '

How to use sqlite3 module with electron?

瘦欲@ 提交于 2019-12-17 04:43:09
问题 I want to develop desktop app using electron that uses sqlite3 package installed via npm with the command npm install --save sqlite3 but it gives the following error in electron browser console Uncaught Error: Cannot find module 'E:\allcode\eapp\node_modules\sqlite3\lib\binding\node-v45-win32-x64\node_sqlite3.node' My development environment is windows 8.1 x64 node version 12.7 my package.json file looks like this: { "name": "eapp", "version": "1.0.0", "description": "", "main": "index.js",

html开发跨平台桌面应用框架 electron 开始开发

浪子不回头ぞ 提交于 2019-12-17 02:06:22
electron electron 是 github 开发的 一款可以利用 Web 技术 开发跨平台桌面应用的框架,最初是 Github 发布的 Atom 编辑器衍生出的 Atom Shell,后更名为 Electron 。Electron 提供了一个能通过 JavaScript 和 HTML 创建桌面应用的平台,基于 nodejs 快速开始 前提 必须安装node 环境 全局安装 electron sudo npm install -g electron #可能会出现安装失败,使用 cnpm 文件结构 your-app ├── package.json ├── main.js └── index.html package.json 文件简单写: { "name" : "your-app", "version" : "0.1.0", "main" : "main.js" } main.js 为入口: const {app, BrowserWindow} = require('electron') const path = require('path') const url = require('url') // 保持一个对于 window 对象的全局引用,如果你不这样做, // 当 JavaScript 对象被垃圾回收, window 会被自动地关闭 let win

npm electron 文档

元气小坏坏 提交于 2019-12-15 19:50:55
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> electron 安装 安装命令代理设置(C:\Users\colin.npmrc) home=https://npm.taobao.org registry=https://registry.npm.taobao.org/ sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ phantomjs_cdnurl=http://npm.taobao.org/mirrors/phantomjs electron_mirror=http://npm.taobao.org/mirrors/electron/ 安装命令 npm install electron -g 来源: oschina 链接: https://my.oschina.net/colin86/blog/3143298

CocosCreator编辑器扩展2-ipc

拈花ヽ惹草 提交于 2019-12-15 09:35:43
总结来说写编辑器扩展需要知道几部分就可以写一些简单插件了,1需要知道你的包的文件都是干嘛的2.明白进程之间的通信(ipc),3可以自己创建自定义编辑器面板,4,了解调用引擎api和项目脚本,以及管理项目资源,这大致几部分,说到底如果你能熟练运用文档应该都不是问题。 首先根据文档来了解一下ipc:Cocos Creator 的编辑器是基于 GitHub 开发的 Electron 内核。Electron 是一个集成了 Node.js 和 Chromimu 的跨平台开发框架。在 Electron 的架构中,一份应用程序由主进程和渲染进程组成,其主进程负责管理平台相关的调度,如窗口的开启关闭,菜单选项,基础对话框等等。而每一个新开启的窗口就是一个独立的渲染进程。在 Electron 中,每个进程独立享有自己的 JavaScript 内容,彼此之间无法直接访问。当我们需要在进程之间传递数据时,就需要使用进程间通信(IPC)。 总结起来就是说一个包应该是有主进程,也就是main,和渲染进程,也就是panel面板,但是各个进程享有自己的javaScript内容无法通信,所以就有了IPC进程之间的通信来告诉对方需要做什么。比如之前的package.json里 { main-menu": { "Packages/Hello World": { "message": "hello-world:say

Electron学习之旅9,create-react-app和electron完成应用打包 + 注意事项,项目错误解决方案,pack到底做了什么,生成安装包,打包优化,自动更新,总结

孤街浪徒 提交于 2019-12-15 03:24:51
记录: electron-vue大佬博客 一、应用打包 使用electron-builder库,先安装它。 1、cnpm i electron-builder -D 2、尝试使用npm run build打包react项目 注意事项一 : 注:electron-is-dev 需要变成生产依赖 3、根据 electron-builder配置文档 去实施 4、配置分基础配置,和不同操作系统配置,对象会覆盖基础配置。 5、增加基础描述,为了使打包的信息详细。 6、增加scripts // pack是出来一个安装完毕的文件,而dist 是打包出来的安装包 "pack" : "electron-builder --dir" , "dist" : "electron-builder" , 7、package.json 内置钩子 preXXX和postXXX 表示在运行pack时,先执行prepack命名,再执行pack,最后执行postpack 此时pack肯定是失败的,因为还缺少很多配置项,所以 注意事项二 :extends: null 二、错误解决方案 1、错误一: 运行npm run pack 打包命令后,出现报错。 检测是拉取electron@7.1.2相关资源失败, 解决方案: 回退至electron@5.0.6 但是发现npm install electron@5.0.6 也报错