More work on The Hub
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
|
|
||||||
// These localStorage values were created when generating the HTML
|
// These localStorage values were created when generating the HTML
|
||||||
// ae value is reset every page load
|
|
||||||
// ae_com value is ?
|
|
||||||
// let ae_local = window.localStorage.getItem('ae'); // Includes: cfg, client, page, other
|
// let ae_local = window.localStorage.getItem('ae'); // Includes: cfg, client, page, other
|
||||||
// let ae_session = window.sessionStorage.getItem('ae'); // Includes: cfg, client, page, other
|
// let ae_session = window.sessionStorage.getItem('ae'); // Includes: cfg, client, page, other
|
||||||
// let ae_com_local = window.localStorage.getItem('ae_com');
|
// let ae_com_local = window.localStorage.getItem('ae_com');
|
||||||
// let ae_com_session = window.sessionStorage.getItem('ae_com');
|
// let ae_com_session = window.sessionStorage.getItem('ae_com');
|
||||||
|
|
||||||
|
if (window.localStorage.getItem('ae') === null) {
|
||||||
|
window.localStorage.setItem('ae', JSON.stringify({ 'cfg': {}, 'client': {}, 'page': {}, 'other': {}, 'test': {} }));
|
||||||
|
}
|
||||||
|
|
||||||
if (window.sessionStorage.getItem('ae') === null) {
|
if (window.sessionStorage.getItem('ae') === null) {
|
||||||
window.sessionStorage.setItem('ae', JSON.stringify({ 'cfg': {}, 'client': {}, 'page': {}, 'other': {}, 'test': {} }));
|
window.sessionStorage.setItem('ae', JSON.stringify({ 'cfg': {}, 'client': {}, 'page': {}, 'other': {}, 'test': {} }));
|
||||||
}
|
}
|
||||||
@@ -41,7 +44,7 @@ const ae_bridge = {
|
|||||||
// },
|
// },
|
||||||
|
|
||||||
|
|
||||||
// Monitor change in local storage AE
|
// Monitor change in **local** storage AE
|
||||||
// Created and set when generating and then rendering the inital HTML and JS
|
// Created and set when generating and then rendering the inital HTML and JS
|
||||||
// ae_local_var: true,
|
// ae_local_var: true,
|
||||||
ae_local_var: JSON.parse(window.localStorage.getItem('ae')),
|
ae_local_var: JSON.parse(window.localStorage.getItem('ae')),
|
||||||
@@ -60,7 +63,7 @@ const ae_bridge = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// Monitor change in session storage AE
|
// Monitor change in **session* storage AE
|
||||||
// Created and set when generating and then rendering the inital HTML and JS
|
// Created and set when generating and then rendering the inital HTML and JS
|
||||||
// ae_session_var: true,
|
// ae_session_var: true,
|
||||||
// ae_session_var: JSON.parse((window.sessionStorage.getItem('ae') ? window.sessionStorage.getItem('ae') : {'cfg': true, 'client': true, 'page': true, 'other': true})),
|
// ae_session_var: JSON.parse((window.sessionStorage.getItem('ae') ? window.sessionStorage.getItem('ae') : {'cfg': true, 'client': true, 'page': true, 'other': true})),
|
||||||
@@ -149,19 +152,22 @@ const ae_bridge = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
console.log('ae_bridge_init.js loaded');
|
console.log('ae_bridge_init.js loaded');
|
||||||
// console.log(ae_bridge.example);
|
|
||||||
// console.log(ae_bridge.ae_com);
|
|
||||||
|
|
||||||
// export let ae_bridge = ae_bridge;
|
|
||||||
|
|
||||||
// export { default as Element_sql_qry }
|
// Updated: 2024-02-09
|
||||||
|
/* BEGIN: Add this to the stores.ts */
|
||||||
|
// This adds a listener to the ae_bridge object. This can then be exported and used in the Svelte components.
|
||||||
|
// export let ae_example = writable(ae_bridge.ae_example);
|
||||||
|
// ae_bridge.register_ae_example_listener((new_value) => {
|
||||||
|
// console.log(`AE Bridge: AE Example: ${new_value}`);
|
||||||
|
// console.log(new_value);
|
||||||
|
|
||||||
/* Add this to the stores.ts */
|
// ae_example.set(new_value);
|
||||||
export let ae_example = writable(ae_bridge.ae_example);
|
// console.log(ae_example);
|
||||||
ae_bridge.register_ae_example_listener((new_value) => {
|
// });
|
||||||
console.log(`AE Bridge: AE Example: ${new_value}`);
|
/* END: Add this to the stores.ts */
|
||||||
console.log(new_value);
|
|
||||||
|
|
||||||
ae_example.set(new_value);
|
|
||||||
console.log(ae_example);
|
/* BEGIN: Add this to the Svelte components */
|
||||||
});
|
// import { ae_example } from './stores';
|
||||||
|
/* END: Add this to the Svelte components */
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In most cases we are just inserting HTML into the DOM. The Svelte module apps can update the ID's of the elements within if needed.
|
||||||
$: if ($ae_app.hub.ds['hub_site_header']) {
|
$: if ($ae_app.hub.ds['hub_site_header']) {
|
||||||
console.log('Hub Site Header:', $ae_app.hub.ds['hub_site_header']);
|
console.log('Hub Site Header:', $ae_app.hub.ds['hub_site_header']);
|
||||||
const site_header_element = document.getElementById('Site-Header');
|
const site_header_element = document.getElementById('Site-Header');
|
||||||
|
|||||||
Reference in New Issue
Block a user