collab_client: Delete unused deferred action `tag`

rhansen-collab_client
Richard Hansen 2021-03-30 17:22:46 -04:00
parent 67e7a822e8
commit 5814b76aa4
1 changed files with 4 additions and 13 deletions

View File

@ -377,11 +377,10 @@ const getCollabClient = (ace2editor, serverVars, initialUserInfo, options, _pad)
// is connected for the first time. // is connected for the first time.
let deferredActions = []; let deferredActions = [];
const defer = (func, tag) => function (...args) { const defer = (func) => function (...args) {
const action = () => { const action = () => {
func.call(this, ...args); func.call(this, ...args);
}; };
action.tag = tag;
if (channelState !== 'CONNECTED') { if (channelState !== 'CONNECTED') {
deferredActions.push(action); deferredActions.push(action);
} else { } else {
@ -389,17 +388,9 @@ const getCollabClient = (ace2editor, serverVars, initialUserInfo, options, _pad)
} }
}; };
const doDeferredActions = (tag) => { const doDeferredActions = () => {
const newArray = []; for (const action of deferredActions) action();
for (let i = 0; i < deferredActions.length; i++) { deferredActions = [];
const a = deferredActions[i];
if ((!tag) || (tag === a.tag)) {
a();
} else {
newArray.push(a);
}
}
deferredActions = newArray;
}; };
const sendClientMessage = (msg) => { const sendClientMessage = (msg) => {