Skip to content
Snippets Groups Projects
Verified Commit a2ce2e40 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Generalise (and fix) live loading script

parent 73f54bfd
No related branches found
No related tags found
Loading
Pipeline #760 failed
......@@ -24,16 +24,12 @@ const clearAsyncInterval = (intervalIndex) => {
}
};
let dashboard_interval = setAsyncInterval(async () => {
let live_load_interval = setAsyncInterval(async () => {
console.log('fetching new data');
const promise = new Promise((resolve) => {
$('#dashboard').load("/?include_by_ajax_full_render=1 #dashboard");
$('#live_load').load(window.location.pathname + " #live_load");
resolve(1);
});
await promise;
console.log('data fetched successfully');
}, 15000);
$(document).on('include_by_ajax_all_loaded', function() {
console.log('Now all placeholders are loaded and replaced with content');
})
......@@ -24,7 +24,7 @@
</div>
{% endfor %}
<div class="row">
<div class="row" id="live_load">
{% for widget in widgets %}
<div class="col s12 m12 l6 xl4">
{% with widget as d_widget %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment