A lot of little changes everywhere. Sorry...

This commit is contained in:
Scott Idem
2024-03-02 20:09:25 -05:00
parent 0dbf869d5d
commit 4db9e68543
12 changed files with 434 additions and 166 deletions

View File

@@ -189,6 +189,9 @@ ae_api_data_struct['headers'] = ae_api_headers;
console.log(`AE Stores - API Data:`, ae_api_data_struct);
export let ae_api = writable(ae_api_data_struct);
// *** BEGIN *** Trigger to update the slct variables and other things.
let ae_trig_template: key_val = {};
export let ae_trig = writable(ae_trig_template);
/* *** BEGIN *** Initialize slct_trigger and slct variables. The slct variable can be stored with local storage. */
// Updated 2024-02-27

View File

@@ -405,10 +405,39 @@ export let process_permission_checks = function process_permission_checks(access
}
// This function will update the URL and send a message to the parent window (iframe).
// The name should be something like "example_id".
// Svelte specific:
// WARNING: Avoid using `history.pushState(...)` and `history.replaceState(...)` as these will conflict with SvelteKit's router. Use the `pushState` and `replaceState` imports from `$app/navigation` instead.
// Updated 2024-03-02
function handle_url_and_message(name: string, value: null|string) {
console.log(`*** handle_url_and_message() *** name=${name} value=${value}`);
if (value) {
let location = window.location.href;
const url = new URL(location);
url.searchParams.set(name, value);
history.pushState({}, '', url);
let message = {name: value};
window.parent.postMessage(message, "*");
} else {
let location = window.location.href;
const url = new URL(location);
url.searchParams.delete(name);
history.pushState({}, '', url);
let message = {name: null};
window.parent.postMessage(message, "*");
}
// console.log('Message sent to parent (iframe):', message);
}
export let ae_util = {
iso_datetime_formatter: iso_datetime_formatter,
extract_prefixed_form_data: extract_prefixed_form_data,
process_permission_checks: process_permission_checks,
handle_url_and_message: handle_url_and_message,
};
// export default ae_util;