electron

path.dirname on Windows path is giving `.`

橙三吉。 提交于 2019-12-11 05:00:48
问题 I in electron am doing: path.dirname('C:\\Users\\Blagoh\\Documents\\GitHub\\Screeenshoter\\dist\\electron\\main') That path is the actual value of my __dirname . How come it is not giving me C:\\Users\\Blagoh\\Documents\\GitHub\\Screeenshoter\\dist\\electron ? I want that main part chopped off. 回答1: Assuming main is a directory inside electron . Also assuming that you have some file called index.js inside main folder where you want to have the path of electron directory . So, you can do path

How to convert a bitmap with javascript to an image?

五迷三道 提交于 2019-12-11 04:59:01
问题 I am building an Electron app. There is a need to have a color picker so I want to build an eye-drop style color picker. I got some hints that robot.js and paper.js might be helpful so I checked them. I'd like to, kind of, combine them together. I use robot.js to get the screen capture with a format of bitmap { width: 2560, height: 1600, byteWidth: 10240, bitsPerPixel: 32, bytesPerPixel: 4, image: <Buffer d0 d0 cd ff d0 d0 cd ff d0 d0 cd ff d0 d0 cd ff d0 d0 cd ff d0 d0 cd ff d0 d0 cd ff d0

How to add my own typescript classes in Electron project

孤者浪人 提交于 2019-12-11 04:50:46
问题 I'm creating a hello world project in Electron and found out I can use Typescript for the Main process, https://electronjs.org/blog/typescript. It says to use Typescript change the file extension from index.js to index.ts and then update the package.json to point to the new script: { "name": "electrontypescript", "version": "1.0.0", "description": "Typescript and Electron", "main": "index.ts", "scripts": { "start": "electron ." }, "devDependencies": { "electron": "^5.0.1" }, "dependencies": {

Environment variable is undefined in electron even it has been set inside webpack.DefinePlugin

和自甴很熟 提交于 2019-12-11 04:47:43
问题 I have a requirement where we need to set dll path based upon whether it is executing in production or in development environment. So I decided to place that value in environment variable and tried to achieve that using webpack.DefinePlugin({}). Method 1: webpack.config.json plugins: [ new webpack.DefinePlugin({ 'process.env.NODE_ENV' : JSON.stringify('production') }) And then I tried to get that value in electron's main process, In my case elec.js elec.js const Electron = require("electron")

Intercept sent notifications from an Electron app

无人久伴 提交于 2019-12-11 04:38:43
问题 Given a 3rd-party Electron app (in my case WhatsApp.app for OSX) I'd like to intercept it's calls to Notification Center as well as calls made to update it's badge. (Specifically I want this so I can display the "unread count" in the system menu bar, using TextBar). There's an app.asar archive under Resources/ , and I can see it uses a specific node module for notifications. Before I dig further, assuming I find what I want to change, what's the way to go about intercepting those calls later?

React - Attaching click handler to dynamic children

给你一囗甜甜゛ 提交于 2019-12-11 04:36:14
问题 I'm trying to display a playlist in my electron app which uses react+flux. For some reason I can not attach a click handler to each playlist item. Here's my code: var Playlist = React.createClass({ render: function() { var list = this.props.list; var playlist = []; for (var i = 0; i < list.length; ++i) { playlist.push( <PlaylistItem song={list[i]} key={i} /> ); } return ( <ul className='playlist'> {playlist} </ul> ) } }); var PlaylistItem = React.createClass({ _play: function() { console.log

Which context is the path relative to?

你。 提交于 2019-12-11 04:23:01
问题 This is a dead simple question and no doubt a duplicate but I've searched around and haven't found an answer which works. (Also I am a refugee from the world of Flex/Actionscript and am still getting used to the strange customs of this Javascript world 😉 ) I am testing the Jimp image lib and using a Jimp example (below). I created a new file,"jimpMethods.js", in a "js" directory and wrapped the Jimp example in a "testJimp" function. I wanted to reference the "house.jpg" in the "assets"

Access a function in main window from renderer process in Electron

老子叫甜甜 提交于 2019-12-11 04:11:48
问题 I am integrating the Skype web sdk conversation control in my application. I have the main process in the background there is a main window (a separate renderer process) there are chat windows (separate renderer processes) which have been opened by clicking on the main window In the main window, I am initialising the Skype Web SDK, signing in the user and then fetching the contact list. Now when I click on a contact, it should open separate chat window and start the conversation control in

Does Electron v4 support ECMAScript modules?

隐身守侯 提交于 2019-12-11 03:51:57
问题 I am writing apps using Electron. The current version, 4.0.6, is based on Node 10.11.0 and Chrome 69.0.3947.106. I thought the latest version of Electron would support ECMAScript (ES6) modules but I have not been able to make them work, so far. In particular, on starting the app, the line: import { runTask } from './action'; gives the run-time error: Uncaught SyntaxError: Unexpected token { Before I put more effort into tracking down the problems, I would like to know the status of module

Electron does not listen keydown event

落爺英雄遲暮 提交于 2019-12-11 03:26:27
问题 I am a backend developer who got a little project to fix it. So my boss gives me an electron project which runs on touch devices. I know that I can listen any key events in Javascript if I use the document object, but in electron it does not work, it says the docuemnt cannot be found . So implemented this when I or other support guy press the F12 button then the dev tools be rendered out in the electron app. mainWindow = new BrowserWindow({ 'web-preferences': {'web-security': false} });