electron

Importing Electron classes with Typescript

早过忘川 提交于 2019-12-13 13:53:16
问题 How can I import Electron classes into a Typescript file, so that the intellisense is functioning? For example, I'd like to turn this: var BrowserWindow = require('browser-window'); var app = require('app'); app.on("ready", function() { var mainWindow = new BrowserWindow({ width: 600, height: 800 }); }); into something like this (doesn't work): /// <reference path="./typings/github-electron/github-electron.d.ts"/> var app = GitHubElectron.App; app.on("ready", function() { var mainWindow = new

Requiring electron dialog from render process is undefined

自作多情 提交于 2019-12-13 12:53:05
问题 I am using electron and am trying to open a file browser when a user clicks on button. From the render process I am trying to include the elctron.dialog package like this. const dialog = require( 'electron' ).dialog; console.log( dialog ); However the result from the console log is undefined I am absolutely sure I am in the rendering process so I am not sure why this is not working. The documentation suggests that this is the correct way of doing things but it appears to not be working. This

Unable to obtain desktop picker dialog @electron

风格不统一 提交于 2019-12-13 08:11:12
问题 I am unable to get desktop picker dialog for available sources. I am newbie can someone guide me what am I missing? In chrome we use "chrome.desktopCapture.chooseDesktopMedia"? I obtained source from below code. function onAccessApproved(error, sources) { if (error) throw error; for (var i = 0; i < sources.length; ++i) { { navigator.webkitGetUserMedia({ audio: false, video: { mandatory: { chromeMediaSource: 'desktop', chromeMediaSourceId: sources[i].id, minWidth: 1280, maxWidth: 1280,

Keeping track of window size in electron

佐手、 提交于 2019-12-13 07:37:57
问题 I'm just starting to play with Electron today. I need to be able to get the available window size, and to update it on the window resize. It seems that this isn't as simple as it is in a conventional JS app. What's the recommended way for keeping track of the window size? At the moment, I have my main process and a single renderer, with no plans to have more than 1 renderer/window open at a time. I have tried to use the following, but it seems completely wrong so I must have misunderstood the

executeJavaScript gives no errors but won't execute code

青春壹個敷衍的年華 提交于 2019-12-13 05:39:10
问题 Okay, as I understand things this should execute the code specified inside executeJavaScript() inside my renderer process. When I include only a console.log() to be executed, things work flawlessly and I see the output inside the developer console. My question then is, what might be causing this to not execute? I've tried adding a console.log() outside of my conditional and still nothing nothing appears inside developer console. What's more depending on where I insert the console.log() errors

How to make cloned DOM element JSON serializable

 ̄綄美尐妖づ 提交于 2019-12-13 05:31:32
问题 I'm currently working with GitHub's Electron framework, and I'm trying to send a cloned DOM element from a preloaded script in a webview through their IPC messaging system to my renderer process. Though, DOM elements are not able to be converted to JSON, and thus the received message is printing out an empty Object ( Object {} ). Here's my code: Preload.js var ipc = require("electron").ipcRenderer; function getData(element, trait){ if(trait === "id"){ var elem = document.getElementById

How can I get Chrome's remote debug URL when using the “remote-debugging-port” in Electron?

倖福魔咒の 提交于 2019-12-13 05:06:52
问题 I've set the remote-debugging-port option for Chrome in my Electron main process: app.commandLine.appendSwitch('remote-debugging-port', '8315') Now, how can I get the ws:// URL that I can use to connect to Chrome? I see that the output while I'm running Electron shows DevTools listening on ws://127.0.0.1:8315/devtools/browser/52ba17be-0c0d-4db6-b6f9-a30dc10df13c but I would like to get this URL from inside the main process. The URL is different every time. How can I get it from inside the

re-creation of main window shows blank page in electronjs

流过昼夜 提交于 2019-12-13 04:33:28
问题 Issue: I'm trying to reopen my main window after network reconnect. But it not working properly. It just shows a white blank page. What I found: I have enabled developer tools for the main window. And I found URL is not right. Console tab window.location.href //showing "chrome-error://chromewebdata/" as url And another thing is developer tools of the old main window is still there. This error is getting even if I'm trying to reload the main window. This error is not going even after if I'm

Cloudinary node.js progress of uploading

旧城冷巷雨未停 提交于 2019-12-13 03:47:27
问题 I used cloudinary in angularjs web SPA and there was nice callback named .progress : .progress(function (info) { //file.progress = Math.round((e.loaded * 100.0) / info.total); //file.status = "Uploading... " + file.progress + "%" console.log(info); }) which was basically logging object with data about uploading status info. Now I'm wondering if I'm able to somehow get same progress when uploading by nodeJS code on server side cloudinary.v2.uploader.upload(path, { resource_type: "video" },

How to run require(“express”); from a TypeScript Angular Component in Electron App

眉间皱痕 提交于 2019-12-13 03:43:38
问题 I'm new to "Angular", "typescript" and "Electron". I created a "server.js" file with the basic example of express. What is the correct way to create a local server for the local network? I want to create an "Angular" "Electron" App with a button to run the express server, but I don't know what to code in order to execute the "server.js" file. function runLocalServer() { servidor = require('server.js'); // This line is a error! .... Thanks for your help. 回答1: TypeScript accepts a normal