Skip to content

Instantly share code, notes, and snippets.

@jiromm
Created July 31, 2018 08:48
Show Gist options
  • Save jiromm/403fa6f4f6cee0225e6c07888bde24bb to your computer and use it in GitHub Desktop.
Save jiromm/403fa6f4f6cee0225e6c07888bde24bb to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="https://cdn.pubnub.com/pubnub-3.7.13.min.js"></script>
<script type="text/javascript">
var isFreeze = false;
function freeze() {
$('#freezeModal').modal({
backdrop: 'static',
keyboard: false,
show: true
});
}
function unfreeze() {
$('#freezeModal').modal('hide');
}
$(document).ready(function() {
var pubnub = PUBNUB({
subscribe_key : 'sub-c-038bd02c-9496-11e8-ad6f-e2c87ef27b4c',
ssl: true
});
pubnub.subscribe({
channel : "bo-up-and-down",
message : function(message){
console.log(message);
if (message.status == 0) {
if (!isFreeze) {
isFreeze = 1;
freeze();
}
} else {
isFreeze = 0
unfreeze();
}
}
})
});
</script>
</head>
<body>
<div class="modal fade" id="freezeModal" tabindex="-1" role="dialog" aria-labelledby="freezeModalLabel">
<div class="modal fade" id="freezeModal" tabindex="-1" role="dialog" aria-labelledby="freezeModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Backoffice is upgrading software</h4>
</div>
<div class="modal-body">
This will take several seconds...
</div>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment