-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
I have this visual calendar function, using electron, started in 2017, using remote
which opens images related to text values in calendar entries, and pongs them over the screen.
multiple images may be shown concurrently based on calendar entries. they never overlay each other
this is under an app using electron to display a single page web app
MagicMirror
I did the new npm install (step 1 of instructions)
this app starts with
our npm start script line
"start": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron js/electron.js",
this process does NOT do a 'require' of electron, as it is INSIDE electron
I do the require('@electron/remote/main').initialize(); at the start of electron.js )very first thing, step2 of instructions)
---no browser window is open yet
it calls some extension initializers, (one of which is my code)
I call
const { BrowserWindow } = require("@electron/remote") (step 3 from the instructions)
but I get an error on startup
"@electron/remote" cannot be required in the browser process. Instead require("@electron/remote/main")
but we haven't opened a page yet,
yes I am in the browser 'process', it runs everything
I will use **new BrowserWindow()** to create and load an image, which floats like pong above the single page web app.
I changed my code to do
const { BrowserWindow } = require("@electron/remote/main") (per the message)
I added the require('@electron/remote/main').enable(viewerinfo.webContents) after the window is created, see below
LATER we open the browser window, but the prior code is running on sep thread events (timers). all before main window is opened
code to open single page web a
and I use these webPreferences in the electronOptions object
webPreferences: {
contextIsolation: false,
nodeIntegration: true,
nodeIntegrationInWorker: true
//zoomFactor: config.zoom
},
// Create the browser window.
mainWindow = new BrowserWindow(electronOptions);
mainWindow.loadURL(`${prefix}${address}:${port}`);
some eons later, cal entry causes need for images to be displayed
my call to new BrowserWindow()
viewerinfo.window = new BrowserWindow({
width: viewerinfo.config.width,
height: viewerinfo.config.height,
x: new_x+self.SCREEN_LEFT,
y: new_y,
alwaysOnTop: true,
show:false,
transparent: true,
backgroundColor: "#000000",
paintWhenInitiallyHidden:true,
dx: 0,
dy: 0,
frame: false,
skipTaskbar: true,
//parent:self.SCREEN_PARENT
})
require('@electron/remote/main').enable(viewerinfo.webContents)but now new fails.. not a constructor
help
Metadata
Metadata
Assignees
Labels
No labels