Splunk Search

JS Wait page fully loaded

timmalos
Communicator

Hi
I can't find any information on this subject so i ask you 🙂
I work on my application.js and i need to do some css work but only when all searches on my dashboard are finished. Some of them need more than 10 seconds to be fully loaded.

Tried the standard Jquery ready but dosn't work:

$(document).ready(function() {}

For now i use

setTimeout(function(){
    $('.panel_row2_col').before("<div id=monitoring></div>");
}, 20000);

But it's clearly only a workaround.

Thx for any help !

Tags (4)
1 Solution

sideview
SplunkTrust
SplunkTrust

There is an event called "PageReady" which is triggered by the PageStatus object.

I'm not sure to what extent the splunk UI uses this itself - possibly only the old pdfserver app uses it still, but I just tested on 5.0.4 and it does appear to still work.

Essentially PageStatus keeps track not just of the main HTML page load, but also all async processes like flash canvas loading, jobs still being dispatched, running jobs still running, flash canvas still rendering etc.. and it only gives the all clear in the form of that "PageReady" event, when everything has settled down and all jobs are completed.

$(document).bind("PageReady", someFunction);

I would throw an extra couple seconds of setTimeout in there for good measure though, because if it's no longer heavily used in the core product there might be some renders that are no longer being factored into the overall "ready" logic.

View solution in original post

0 Karma

sideview
SplunkTrust
SplunkTrust

There is an event called "PageReady" which is triggered by the PageStatus object.

I'm not sure to what extent the splunk UI uses this itself - possibly only the old pdfserver app uses it still, but I just tested on 5.0.4 and it does appear to still work.

Essentially PageStatus keeps track not just of the main HTML page load, but also all async processes like flash canvas loading, jobs still being dispatched, running jobs still running, flash canvas still rendering etc.. and it only gives the all clear in the form of that "PageReady" event, when everything has settled down and all jobs are completed.

$(document).bind("PageReady", someFunction);

I would throw an extra couple seconds of setTimeout in there for good measure though, because if it's no longer heavily used in the core product there might be some renders that are no longer being factored into the overall "ready" logic.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...