10 examples of 'javascript auto refresh page with timer' in JavaScript

Every line of 'javascript auto refresh page with timer' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
6function auto_refresh(){
7 var element = $(".auto-refresh");
8 clearTimeout(refresh_timeout);
9
10 if (element[0]) {
11 refresh_timeout = setTimeout(function(){
12 var autoRefreshIsOn = $(".auto-refresh").hasClass("on");
13 var hasFocus = tfm.document.doesDocumentHasFocus();
14
15 if (autoRefreshIsOn && hasFocus) {
16 Turbolinks.visit(window.location.href);
17 }
18 }, 60000);
19 }
20}
109doRefresh(refresher): void {
110 this.reload = !this.reload;
111 setTimeout(() => {
112 refresher.complete();
113 }, 300);
114}
80setUpAutoRefresh(): void {
81 if (this.props.shouldRefresh) {
82 if (this.refreshIntervalId) {
83 // The auto-refresh is already enabled.
84 return;
85 }
86 this.refreshIntervalId = setInterval(
87 () => this.props.dispatch(refreshStatus()),
88 60000
89 );
90 } else {
91 this.stopAutoRefresh();
92 }
93}
16doRefresh(refresher) {
17
18 setTimeout(() => {
19 refresher.complete();
20 }, 2000);
21}
470setTimeout(function refresh() {
471 $("#block").fadeOut("slow");
472}, 1000);
33$(function refresh() {
34 $.getJSON('/', function(data, textStatus, jqXHR) {
35 $('#version').text(jqXHR.getResponseHeader('X-Pult-Version'));
36 $('#domains').empty();
37 for (var key in data) {
38 if (key == 'pult.dev') {
39 continue;
40 } else if (key == 'next') {
41 $('#next').text(data.next);
42 } else {
43 $('<a>')
44 .addClass('list-group-item')
45 .attr('href', 'http://' + key)
46 .append($('<strong>').text(key))
47 .append($('<span>').addClass('badge').text(data[key]))
48 .appendTo('#domains');
49 }
50 }
51 });
52 setTimeout(refresh, 3000);
53});</span></strong></a>
95function RetrieveRefreshInterval(fnCallBack, enableConsoleOutput) {
96
97 var qvDoc = Qv.GetCurrentDocument();
98 qvDoc.GetAllVariables(function (vars) {
99
100 for (var i = 0; i &lt; vars.length; i++) {
101 var obj = vars[i];
102
103 if ((obj.isreserved == "false") &amp;&amp; (obj.isconfig == "false")) {
104 ConsoleLog('Variable Loop: ' + obj.name + ' = ' + obj.value, enableConsoleOutput);
105
106 if (obj.name.toLowerCase() == cRefreshInterval_VariableName.toLowerCase()) {
107 try {
108 _this.ExtSettings.RefreshInterval = parseInt(obj.value);
109 ConsoleLog('Set variable value to ' + obj.value.toString(), enableConsoleOutput);
110 } catch (e) {
111 ConsoleError('Value of cRefreshInterval_VariableName is not a valid int value', enableConsoleOutput);
112 }
113 break;
114 }
115 }
116 }
117 fnCallBack();
118 });
119}
40refreshNow(force = false) {
41 const currentId = this.options.getCurrentId();
42 const lastRefreshForId = this._refreshesPerId.get(currentId) || 0;
43 const delta = performance.now() - lastRefreshForId;
44 if (force || delta &gt; this.options.minimumIntervalPerId) {
45 this._refreshesPerId.set(currentId, performance.now());
46 this.options.refresh();
47 }
48 // Schedule another refresh if one is already scheduled
49 if (this._timer) {
50 this._clearTimer();
51 this._scheduleNext();
52 }
53}
295function startRefresh() {
296 setTimeout(startRefresh, 15000);
297
298 switchPortTable.ajax.reload();
299 eventTable.ajax.reload();
300}
15function change_refresh() {
16 $('#alerts').html("<div>Please wait... Refreshing data." +
17 "</div>")
18 setTimeout(function () { run_ajax(); }, 1000)
19};

Related snippets