Changes from before AAPOR

This commit is contained in:
Scott Idem
2024-05-20 17:24:23 -04:00
parent f72d7be5b2
commit fa58d1accb
13 changed files with 609 additions and 21 deletions

View File

@@ -199,6 +199,48 @@ onMount(() => {
$slct.sponsorship_cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
$ae_loc.mod.sponsorships.cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
}
// TESTING TESTING TESTING
// WARNING: This needs to be tied to an object type and ID. This is a temporary solution.
$ae_sess.download = {
'endpoint': '/event/file/abc123/download',
'filename': 'example.txt',
'size_total': 0,
'size_loaded': 0,
'percent_completed': 0,
};
window.addEventListener('message', function(event) {
console.log('Message received in root +layout.svelte:');
console.log(event);
if (event.data.type == 'api_download_blob') {
console.log('Download blob (file) message received:', event.data);
// Get the event_file_id from the event.data.endpoint value.
// Example: /event/file/abc123/download
let endpoint = event.data.endpoint;
// let event_file_id = endpoint.split('/')[3];
// ae_downloads[event_file_id] = {
$ae_sess.download = {
'endpoint': endpoint,
'filename': event.data.filename,
'size_total': event.data.size_total,
'size_loaded': event.data.size_loaded,
'percent_completed': event.data.percent_completed,
};
// let event_file_id = event.data.event_file_id;
// let filename = event.data.filename;
// let auto_download = event.data.auto_download;
// ae_promises[event_file_id]
// ae_promises[event_file_id] = download_event_file({ 'event_file_id': event_file_id, 'return_file': true, filename: filename, auto_download: auto_download, log_lvl: 1 });
}
});
});
</script>