7 examples of 'javascript auto refresh' in JavaScript

Every line of 'javascript auto refresh' 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
this disclaimer
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}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

18function forceScriptRefresh(html) {
19 return docUtils.replaceScripts(html, function(parsedTag) {
20 if(!parsedTag.scriptUrl) {
21 return undefined;
22 }
23 var url = urlParser.cacheBustingUrl(parsedTag.scriptUrl, now);
24 return parsedTag.scriptOpenTag.replace(parsedTag.scriptUrl, url)+"</script>";
25 });
26}
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});
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}
25function refresh(id) {
26 if(id !== "avascript:void(0)") {
27 var iframeSelectName = "#" + id + " iframe"
28 $(iframeSelectName).attr('src', $(iframeSelectName).attr('src'));
29 }
30}
79function autoRefresh() {
80 if(document.getElementById("autorefresh").checked) {
81 redrawChart();
82 setTimeout("autoRefresh()",3000);
83 }
84}

Related snippets