Refractoring Stage 6.1 Started renderer modularization with shared state.

This commit is contained in:
2026-10-16 18:17:48 +03:00
parent 0737892766
commit 297fe77fc1
13 changed files with 122 additions and 17 deletions
+37
View File
@@ -0,0 +1,37 @@
(function installRendererState(root, createState) {
if (typeof module === 'object' && module.exports) {
module.exports = { createRendererState: createState };
return;
}
createState(root);
})(typeof window === 'undefined' ? globalThis : window, function createRendererState(root) {
const state = {
messages: [],
contacts: [],
activeMessage: 1,
activeFolder: 'Inbox',
activeView: 'mail',
query: '',
toastTimer: null,
selectedIds: new Set()
};
Object.defineProperty(root, 'epMailState', {
value: state,
enumerable: false,
configurable: false,
writable: false
});
// Transitional aliases keep the existing classic-script features working while they migrate.
for (const key of Object.keys(state)) {
Object.defineProperty(root, key, {
get() { return state[key]; },
set(value) { state[key] = value; },
enumerable: false,
configurable: false
});
}
return state;
});