Guide to replace remote module with better writing style
See original GitHub issueCan there be a guide to teach us how to replace things like remote.getCurrentWindow()
to something better?
I can’t find a good article for this, only an article telling remote module should be replaced by something better (https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31) which is somehow useless.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Tutorial - A Guide to Module Federation for Enterprise
A guide for supporting a fully dynamic, multi-environment Module Federation configuration. Tagged with modulefederation, webpack, ...
Read more >Module Development · bitfocus/companion Wiki - GitHub
Developers Guide. Ish. So, you want to develop a module for Companion? Welcome! This document describes what you need to know and do...
Read more >Documentation Style Guide - GitLab Docs
Documentation Style Guide. This document defines the standards for GitLab documentation, including grammar, formatting, word use, and more.
Read more >Replace all instances of a particular string in a file using a ...
This module will replace all instances of a pattern within a file. ... The character encoding for reading and writing the file. Default:...
Read more >Structuring Your Project - The Hitchhiker's Guide to Python
In this section, we take a closer look at Python's modules and import systems as they are the central elements to enforcing structure...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ipcMain.handle()
does provide the sender. https://www.electronjs.org/docs/api/structures/ipc-main-invoke-evente.g.
Is there a safe package to “Passing callbacks to the main process”?
I think I can iterate through the object, replace each object method with a random uuid, and send this object without a callback to the main thread.
And I register
IPCRenderer.on(uuid
for each object method, and reconstruct the object with callback on the main process, the callback is justIPCMain.invoke(uuid
. Is there any existing package to do so?I think I will use remote module again, I think it is not harmful if you enable all security settings https://github.com/electron/remote/issues/47
Update: I write my own function as descript above to proxy menu item from renderer to the main. The drawback is the callback can’t get the webContent and ElectronEvent instance on the renderer. But this allows dynamic content to add custom menu items with callback.