mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Forgot usefull functions
This commit is contained in:
parent
372fd04948
commit
d172e9cd02
@ -308,6 +308,12 @@
|
||||
}
|
||||
|
||||
wsInternal.send(JSON.stringify(message));
|
||||
},
|
||||
close: function (code, reason) {
|
||||
wsInternal.close(code, reason);
|
||||
},
|
||||
getStatus: function () {
|
||||
return wsInternal.readyState;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@ -323,7 +329,7 @@
|
||||
|
||||
// Managing Connexions for Multi Tab opened to reduce bandwith usage
|
||||
document.addEventListener("visibilitychange", () => {
|
||||
if (document.hidden) {
|
||||
if (document.visibilityState == "hidden") {
|
||||
websocketTimeoutId = setTimeout(() => {
|
||||
webSocket.close(1000, "Closed due to Inactivity");
|
||||
console.log('%c[Crafty Controller] %cClose Websocket due to Tab not active after 5s', 'font-weight: 900; color: #800080;', 'font-weight: 900; color: #eee;');
|
||||
|
@ -54,9 +54,7 @@
|
||||
<script src="/static/assets/js/shared/off-canvas.js"></script>
|
||||
<script src="/static/assets/js/shared/hoverable-collapse.js"></script>
|
||||
<script src="/static/assets/js/shared/misc.js"></script>
|
||||
<!-- endinject -->
|
||||
{% block js %}
|
||||
<!-- Custom js for this page -->
|
||||
|
||||
<script>
|
||||
/* Script for WebSockets */
|
||||
let usingWebSockets = false;
|
||||
@ -137,6 +135,12 @@
|
||||
}
|
||||
|
||||
wsInternal.send(JSON.stringify(message));
|
||||
},
|
||||
close: function (code, reason) {
|
||||
wsInternal.close(code, reason);
|
||||
},
|
||||
getStatus: function () {
|
||||
return wsInternal.readyState;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@ -152,7 +156,7 @@
|
||||
|
||||
// Managing Connexions for Multi Tab opened to reduce bandwith usage
|
||||
document.addEventListener("visibilitychange", () => {
|
||||
if (document.hidden) {
|
||||
if (document.visibilityState == "hidden") {
|
||||
websocketTimeoutId = setTimeout(() => {
|
||||
webSocket.close(1000, "Closed due to Inactivity");
|
||||
console.log('%c[Crafty Controller] %cClose Websocket due to Tab not active after 5s', 'font-weight: 900; color: #800080;', 'font-weight: 900; color: #eee;');
|
||||
@ -165,7 +169,9 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- endinject -->
|
||||
{% block js %}
|
||||
<!-- Custom js for this page -->
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
let login_opacity_div = document.getElementById('login_opacity');
|
||||
|
Loading…
Reference in New Issue
Block a user