|
|
@ -1426,17 +1426,17 @@ var onMatrixSnapshotReady = function(response) {
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
var matrixSnapshotPoller = (function() {
|
|
|
|
const matrixSnapshotPoller = (function() {
|
|
|
|
var timer = null;
|
|
|
|
let timer;
|
|
|
|
|
|
|
|
|
|
|
|
var preprocessMatrixSnapshot = function(snapshot) {
|
|
|
|
const preprocessMatrixSnapshot = function(snapshot) {
|
|
|
|
if ( Array.isArray(snapshot.headerIndices) ) {
|
|
|
|
if ( Array.isArray(snapshot.headerIndices) ) {
|
|
|
|
snapshot.headerIndices = new Map(snapshot.headerIndices);
|
|
|
|
snapshot.headerIndices = new Map(snapshot.headerIndices);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return snapshot;
|
|
|
|
return snapshot;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var processPollResult = function(response) {
|
|
|
|
const processPollResult = function(response) {
|
|
|
|
if ( typeof response !== 'object' ) {
|
|
|
|
if ( typeof response !== 'object' ) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1448,8 +1448,9 @@ var matrixSnapshotPoller = (function() {
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
matrixSnapshot = preprocessMatrixSnapshot(response);
|
|
|
|
if ( response instanceof Object ) {
|
|
|
|
|
|
|
|
matrixSnapshot = preprocessMatrixSnapshot(response);
|
|
|
|
|
|
|
|
}
|
|
|
|
if ( response.mtxContentModified ) {
|
|
|
|
if ( response.mtxContentModified ) {
|
|
|
|
makeMenu();
|
|
|
|
makeMenu();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -1468,12 +1469,12 @@ var matrixSnapshotPoller = (function() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var onPolled = function(response) {
|
|
|
|
const onPolled = function(response) {
|
|
|
|
processPollResult(response);
|
|
|
|
processPollResult(response);
|
|
|
|
pollAsync();
|
|
|
|
pollAsync();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var pollNow = function() {
|
|
|
|
const pollNow = function() {
|
|
|
|
unpollAsync();
|
|
|
|
unpollAsync();
|
|
|
|
vAPI.messaging.send('popup.js', {
|
|
|
|
vAPI.messaging.send('popup.js', {
|
|
|
|
what: 'matrixSnapshot',
|
|
|
|
what: 'matrixSnapshot',
|
|
|
@ -1487,25 +1488,22 @@ var matrixSnapshotPoller = (function() {
|
|
|
|
}, onPolled);
|
|
|
|
}, onPolled);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var poll = function() {
|
|
|
|
const pollAsync = function() {
|
|
|
|
timer = null;
|
|
|
|
if ( timer !== undefined ) { return; }
|
|
|
|
pollNow();
|
|
|
|
if ( document.defaultView === null ) { return; }
|
|
|
|
};
|
|
|
|
timer = vAPI.setTimeout(
|
|
|
|
|
|
|
|
( ) => {
|
|
|
|
var pollAsync = function() {
|
|
|
|
timer = undefined;
|
|
|
|
if ( timer !== null ) {
|
|
|
|
pollNow();
|
|
|
|
return;
|
|
|
|
},
|
|
|
|
}
|
|
|
|
1414
|
|
|
|
if ( document.defaultView === null ) {
|
|
|
|
);
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
timer = vAPI.setTimeout(poll, 1414);
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var unpollAsync = function() {
|
|
|
|
const unpollAsync = function() {
|
|
|
|
if ( timer !== null ) {
|
|
|
|
if ( timer !== undefined ) {
|
|
|
|
clearTimeout(timer);
|
|
|
|
clearTimeout(timer);
|
|
|
|
timer = null;
|
|
|
|
timer = undefined;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -1514,7 +1512,7 @@ var matrixSnapshotPoller = (function() {
|
|
|
|
|
|
|
|
|
|
|
|
// If no tab id yet, see if there is one specified in our URL
|
|
|
|
// If no tab id yet, see if there is one specified in our URL
|
|
|
|
if ( tabId === undefined ) {
|
|
|
|
if ( tabId === undefined ) {
|
|
|
|
var matches = window.location.search.match(/(?:\?|&)tabId=([^&]+)/);
|
|
|
|
const matches = window.location.search.match(/(?:\?|&)tabId=([^&]+)/);
|
|
|
|
if ( matches !== null ) {
|
|
|
|
if ( matches !== null ) {
|
|
|
|
tabId = parseInt(matches[1], 10);
|
|
|
|
tabId = parseInt(matches[1], 10);
|
|
|
|
// No need for logger button when embedded in logger
|
|
|
|
// No need for logger button when embedded in logger
|
|
|
@ -1522,8 +1520,8 @@ var matrixSnapshotPoller = (function() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var snapshotFetched = function(response) {
|
|
|
|
const snapshotFetched = function(response) {
|
|
|
|
if ( typeof response === 'object' ) {
|
|
|
|
if ( response instanceof Object ) {
|
|
|
|
matrixSnapshot = preprocessMatrixSnapshot(response);
|
|
|
|
matrixSnapshot = preprocessMatrixSnapshot(response);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onMatrixSnapshotReady(response);
|
|
|
|
onMatrixSnapshotReady(response);
|
|
|
|