Skip to content

Commit 9349e33

Browse files
author
Fredrik Borg
committed
call poll method immediately on focus
1 parent 690ff7e commit 9349e33

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

django_unicorn/static/js/component.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,15 @@ export class Component {
328328
clearInterval(this.poll.timer);
329329
}
330330
} else {
331+
// tab gets focus -> call poll method once and
332+
// start polling at intervals
333+
if (this.isPollEnabled()) {
334+
this.callMethod(
335+
this.poll.method,
336+
this.poll.partials,
337+
this.handlePollError
338+
);
339+
}
331340
this.startPolling();
332341
}
333342
},

0 commit comments

Comments
 (0)