Adding a reconnect feature in case first Pusher request fails
Now, if the first pusher request fails, a waiting message will be displayed and the application will reconnect when the pusher comes back alive or the network connection is established again.
This commit is contained in:
parent
9eb4206fe0
commit
fcf0888864
17 changed files with 981 additions and 32 deletions
47
maps/tests/Variables/E2ETests/shared_variables.html
Normal file
47
maps/tests/Variables/E2ETests/shared_variables.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<script>
|
||||
var script = document.createElement('script');
|
||||
// Don't do this at home kids! The "document.referrer" part is actually inserting a XSS security.
|
||||
// We are OK in this precise case because the HTML page is hosted on the "maps" domain that contains only static files.
|
||||
document.head.appendChild(script);
|
||||
window.addEventListener('load', () => {
|
||||
console.log('On load');
|
||||
WA.onInit().then(() => {
|
||||
console.log('After WA init');
|
||||
const textField = document.getElementById('textField');
|
||||
textField.value = WA.state.textField;
|
||||
|
||||
textField.addEventListener('change', function (evt) {
|
||||
console.log('saving variable')
|
||||
WA.state.textField = this.value;
|
||||
});
|
||||
|
||||
WA.state.onVariableChange('textField').subscribe((value) => {
|
||||
console.log('variable changed received')
|
||||
textField.value = value;
|
||||
});
|
||||
|
||||
document.getElementById('btn').addEventListener('click', () => {
|
||||
console.log(WA.state.loadVariable('textField'));
|
||||
document.getElementById('placeholder').innerText = WA.state.loadVariable('textField');
|
||||
});
|
||||
|
||||
document.getElementById('setUndefined').addEventListener('click', () => {
|
||||
WA.state.textField = undefined;
|
||||
document.getElementById('textField').value = '';
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<input type="text" id="textField" />
|
||||
|
||||
<button id="setUndefined">Delete variable</button>
|
||||
|
||||
<button id="btn">Display textField variable value</button>
|
||||
<div id="placeholder"></div>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue