D
D
Dmitry Shnyrev2017-01-15 21:33:10
JavaScript
Dmitry Shnyrev, 2017-01-15 21:33:10

How to reach the application on Electron?

Hello!
Help advice.
I plan to file an application on Electron . But there is one question that I have not yet figured out how to implement. I need to somehow access (call a method) a method inside the app from outside. For example, there is a real application (MavensMate) that plugins of various text editors can access. Those. I launch it, minimize it and then continue to work in Sublime Text and from the context menu of the editor I can call certain logic from MavensMate, while the application window becomes active and the part of the UI I need is shown in it.
So far I have not found in the documentation how to organize something similar. Perhaps it hasn't arrived yet.
I would appreciate any hints and ideas.
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2017-01-15
@dmnBrest

In electron, raise a local server (http/websocket/tcp socket - it doesn't matter), where you can send commands and receive a response.

D
Dmitry Shnyrev, 2017-01-16
@dmnBrest

I will add here as an answer what happened (maybe it will come in handy for someone)
- raised inside the Electron (mainProcess) ExpressJS server;
- inside the request handler added
win.webContents.send('superEvent', 'PING');
- inside the window handler (rendererProcess) hung the listener
ipcRenderer.on('superEvent', (event, arg) => {alert('PONG');})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question