Hi there 👋
zoubingwu / electron-shared-state Goto Github PK
View Code? Open in Web Editor NEW❤️ easily sharing state across electron main and renderer processes.
License: MIT License
❤️ easily sharing state across electron main and renderer processes.
License: MIT License
Hi there 👋
Using the latest version in an Electron app (electron-forge with webpack). If I import
the library it works fine. But I also have to require
it in main.js
, since it is Common JS, and that results in the above error.
Since one uses the dist/index.mjs.js
file and the other the dist/index.cjs.js
I suspect something with how the latter is built is amiss.
It could conceivably also be how my project builds, but I donät think so since the error points straight to the file in node_modules
.
I could also solve the problem by converting the project to mjs, but I tried that and got stuck 🙂 Too bad that the boilerplate is still in cjs ...
It looks like this module only allows you to create one shared store.
I have different states that I need to share between different windows. For instance, Store A needs to be shared between Main and Window 1, while Store B needs to be shared between Main, Window 1, and Window 2.
Would you be open to a pull request which adds the ability to create multiple named stores? Offhand, it might look like this:
const sharedStoreA = createSharedStore(initialStateA, 'store_a')
const sharedStoreB = createSharedStore(initialStateB, 'store_b')
Then we might append this name onto the INTERNAL_CHANNEL
value so that the IPC listeners would just listen/send on different channels for the different stores. If someone didn't give a storeName value, then we would fall back to the current functionality.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.