Closed CanadaHonk closed 1 year ago
Proposal for adding a "Store" to IPC, accessible to both Node and Web, for easily sharing common data between them. Not persistent. Example usage:
Web would fetch config key from IPC when gotten, hence being async.
// Node backend Window.ipc.store.config = { env: 'prod' };
// Web frontend const runningEnv = (await Gluon.ipc.store.config).env;
Web would be sent updated Store key and values whenever they are set, hence being sync.
// Web frontend const runningEnv = Gluon.ipc.store.config.env;
// Node backend Window.ipc.store.set('config', { env: 'prod' });
// Web frontend const runningEnv = (await Gluon.ipc.store.get('config')).env;
// Web frontend const runningEnv = Gluon.ipc.store.get('config').env;
Please comment with which proposal(s), you prefer! Open to implementing 1/2 and 3/4.
My vote for 2
Same here, 2 is cleanest imo.
for anyone who doesn't understand the code here's what it is in English
Proposals 2 and 4 were implemented in v0.11.0
Proposal for adding a "Store" to IPC, accessible to both Node and Web, for easily sharing common data between them. Not persistent. Example usage:
Proposal 1 - Async getter/getter
Web would fetch config key from IPC when gotten, hence being async.
Proposal 2 - Sync getter/getter
Web would be sent updated Store key and values whenever they are set, hence being sync.
Proposal 3 - Async Functions
Proposal 4 - Sync Functions
Please comment with which proposal(s), you prefer! Open to implementing 1/2 and 3/4.