Transpiled version (2922L) is out of date.
1  | sS hjs_sendWindowVisibilityToWebSocket() {
 | 
2  | ret hjs([[  | 
3  | // version 1  | 
4  | |
5  | var isTabActive;  | 
6  | |
7  |     function wsSendTabActive() {
 | 
8  |       wsOnOpen(function() {
 | 
9  |         console.log("isTabActive=" + isTabActive);
 | 
10  |         console.log("Sending");
 | 
11  |         ws.send(JSON.stringify({"isTabActive": isTabActive}));
 | 
12  | });  | 
13  | }  | 
14  | |
15  | wsSendTabActive();  | 
16  | |
17  |     window.onfocus = function () { 
 | 
18  | isTabActive = true;  | 
19  | wsSendTabActive();  | 
20  | };  | 
21  | |
22  |     window.onblur = function () { 
 | 
23  | isTabActive = false;  | 
24  | wsSendTabActive();  | 
25  | };  | 
26  | |
27  | // version 2  | 
28  | |
29  |     function wsSendVisibility() {
 | 
30  |       wsOnOpen(function() {
 | 
31  | var vis = document.visibilityState;  | 
32  |         console.log("visibility=" + vis);
 | 
33  |         ws.send(JSON.stringify({"visibility": vis}));
 | 
34  | });  | 
35  | }  | 
36  | |
37  | wsSendVisibility();  | 
38  |     document.addEventListener("visibilityChange", wsSendVisibility);
 | 
39  | ]]);  | 
40  | }  | 
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1031659 | 
| Snippet name: | hjs_sendWindowVisibilityToWebSocket | 
| Eternal ID of this version: | #1031659/9 | 
| Text MD5: | ce31cdd7684c4987e5cf2d16e95003d2 | 
| Author: | stefan | 
| Category: | javax | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2021-06-27 08:12:22 | 
| Source code size: | 942 bytes / 40 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 424 / 546 | 
| Version history: | 8 change(s) | 
| Referenced in: | [show references] |