v2 - all functions need bind self

This commit is contained in:
2018-12-18 01:57:56 +01:00
parent a1db2a34ef
commit a4b4c0ce61
3 changed files with 40 additions and 30 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/*Generated on:Tue Dec 18 2018 01:51:44 GMT+0100 (CET)*/ /*Generated on:Tue Dec 18 2018 01:57:56 GMT+0100 (CET)*/
var AutomaticDispose_Branch = "master"; var AutomaticDispose_Branch = "master";
var AutomaticDispose_URL = "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/"; var AutomaticDispose_URL = "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/";
var da_lss_adis_time = new Date().getTime(); var da_lss_adis_time = new Date().getTime();
+20 -15
View File
@@ -1,4 +1,4 @@
/*Generated on:Tue Dec 18 2018 01:51:44 GMT+0100 (CET)*/ /*Generated on:Tue Dec 18 2018 01:57:56 GMT+0100 (CET)*/
/* /*
* Dexie.js - a minimalistic wrapper for IndexedDB * Dexie.js - a minimalistic wrapper for IndexedDB
* =============================================== * ===============================================
@@ -17142,10 +17142,11 @@ class AutomaticDispose {
setInterval(self.OpenNextPoliceSprechwunsch.bind(self), 5000); setInterval(self.OpenNextPoliceSprechwunsch.bind(self), 5000);
self.CollectPoliceSprechwuensche(); self.CollectPoliceSprechwuensche();
setTimeout(() => { setTimeout(function() {
const self = this;
self.CollectMissions(); self.CollectMissions();
self.ReadAndAddMissions(); self.ReadAndAddMissions();
}, 500); }.bind(self), 500);
self.ADisSettings.runner.forEach((runner) => { self.ADisSettings.runner.forEach((runner) => {
self.OpenNextMission(runner) self.OpenNextMission(runner)
@@ -17257,12 +17258,13 @@ class AutomaticDispose {
$("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID); $("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID);
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID); $("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID);
self.RescueVehicleFrameWatchDog = setTimeout(async () => { self.RescueVehicleFrameWatchDog = setTimeout(async function () {
const self = this;
self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => { self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => {
$("#adis-sprechwunsch-rescue-frame").attr("src", ""); $("#adis-sprechwunsch-rescue-frame").attr("src", "");
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty"); $("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty");
}); });
}, 1500); }.bind(self), 1500);
} }
}); });
}); });
@@ -17447,12 +17449,13 @@ class AutomaticDispose {
$("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID); $("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
$("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID); $("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID);
self.PoliceVehicleFrameWatchDog = setTimeout(async (MissionID) => { self.PoliceVehicleFrameWatchDog = setTimeout(async function (MissionID) {
const self = this;
self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => { self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
$("#adis-sprechwunsch-police-frame").attr("src", ""); $("#adis-sprechwunsch-police-frame").attr("src", "");
$("#adis-sprechwunsch-police-frame").attr("mission_id", "empty"); $("#adis-sprechwunsch-police-frame").attr("mission_id", "empty");
}); });
}, 1500, MissionID); }.bind(self), 1500, MissionID);
} }
}); });
}); });
@@ -18470,7 +18473,7 @@ class AutomaticDispose {
} else if (['adis-verbandmission', 'adis-verbandmission-event'].indexOf(window.name) != -1) { } else if (['adis-verbandmission', 'adis-verbandmission-event'].indexOf(window.name) != -1) {
self.WorkVerbandMission(); self.WorkVerbandMission();
} }
}, 250); }.bind(self), 250);
} }
} }
@@ -18600,7 +18603,8 @@ class AutomaticDispose {
StartAlarmProcess() { StartAlarmProcess() {
const self = this; const self = this;
const alarming = function alarming(self) { const alarming = function alarming() {
const self = this;
Promise.resolve().then(async () => { Promise.resolve().then(async () => {
return await self.PrepareVehicleNeedList(); return await self.PrepareVehicleNeedList();
}).then(async () => { }).then(async () => {
@@ -18650,13 +18654,13 @@ class AutomaticDispose {
// console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#vehicle_show_table_all input[type="checkbox"]:checked')); // console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#vehicle_show_table_all input[type="checkbox"]:checked'));
// console.log("WILL KLICK SEND") // console.log("WILL KLICK SEND")
setTimeout(() => { setTimeout(function () {
self.UpdateMissionsToDone(self.MissionID).then(() => { self.UpdateMissionsToDone(self.MissionID).then(() => {
tellParent(`console.log('ok:${window.name}:${self.MissionID}');`); tellParent(`console.log('ok:${window.name}:${self.MissionID}');`);
window.$('#mission_alarm_btn').click(); window.$('#mission_alarm_btn').click();
}); });
}, 250); }.bind(self), 250);
}) })
}; };
@@ -18670,8 +18674,8 @@ class AutomaticDispose {
mutations.forEach(function (mutation) { mutations.forEach(function (mutation) {
if (mutation.attributeName === "style") { if (mutation.attributeName === "style") {
setTimeout(function () { setTimeout(function () {
alarming(self) alarming()
}, 500); }.bind(self), 500);
} }
}); });
}); });
@@ -18682,8 +18686,9 @@ class AutomaticDispose {
$div.click(); $div.click();
} else { } else {
setTimeout(function () { setTimeout(function () {
alarming(self) const self = this;
}, 250); alarming().bind(self)
}.bind(self), 250);
} }
+19 -14
View File
@@ -135,10 +135,11 @@ class AutomaticDispose {
setInterval(self.OpenNextPoliceSprechwunsch.bind(self), 5000); setInterval(self.OpenNextPoliceSprechwunsch.bind(self), 5000);
self.CollectPoliceSprechwuensche(); self.CollectPoliceSprechwuensche();
setTimeout(() => { setTimeout(function() {
const self = this;
self.CollectMissions(); self.CollectMissions();
self.ReadAndAddMissions(); self.ReadAndAddMissions();
}, 500); }.bind(self), 500);
self.ADisSettings.runner.forEach((runner) => { self.ADisSettings.runner.forEach((runner) => {
self.OpenNextMission(runner) self.OpenNextMission(runner)
@@ -250,12 +251,13 @@ class AutomaticDispose {
$("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID); $("#adis-sprechwunsch-rescue-frame").attr("src", "https://www.leitstellenspiel.de/vehicles/" + VehicleID);
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID); $("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", VehicleID);
self.RescueVehicleFrameWatchDog = setTimeout(async () => { self.RescueVehicleFrameWatchDog = setTimeout(async function () {
const self = this;
self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => { self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => {
$("#adis-sprechwunsch-rescue-frame").attr("src", ""); $("#adis-sprechwunsch-rescue-frame").attr("src", "");
$("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty"); $("#adis-sprechwunsch-rescue-frame").attr("vehicle_id", "empty");
}); });
}, 1500); }.bind(self), 1500);
} }
}); });
}); });
@@ -440,12 +442,13 @@ class AutomaticDispose {
$("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID); $("#adis-sprechwunsch-police-frame").attr("src", "https://www.leitstellenspiel.de/missions/" + MissionID);
$("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID); $("#adis-sprechwunsch-police-frame").attr("mission_id", MissionID);
self.PoliceVehicleFrameWatchDog = setTimeout(async (MissionID) => { self.PoliceVehicleFrameWatchDog = setTimeout(async function (MissionID) {
const self = this;
self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => { self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => {
$("#adis-sprechwunsch-police-frame").attr("src", ""); $("#adis-sprechwunsch-police-frame").attr("src", "");
$("#adis-sprechwunsch-police-frame").attr("mission_id", "empty"); $("#adis-sprechwunsch-police-frame").attr("mission_id", "empty");
}); });
}, 1500, MissionID); }.bind(self), 1500, MissionID);
} }
}); });
}); });
@@ -1229,7 +1232,7 @@ class AutomaticDispose {
} else if (['adis-verbandmission', 'adis-verbandmission-event'].indexOf(window.name) != -1) { } else if (['adis-verbandmission', 'adis-verbandmission-event'].indexOf(window.name) != -1) {
self.WorkVerbandMission(); self.WorkVerbandMission();
} }
}, 250); }.bind(self), 250);
} }
} }
@@ -1359,7 +1362,8 @@ class AutomaticDispose {
StartAlarmProcess() { StartAlarmProcess() {
const self = this; const self = this;
const alarming = function alarming(self) { const alarming = function alarming() {
const self = this;
Promise.resolve().then(async () => { Promise.resolve().then(async () => {
return await self.PrepareVehicleNeedList(); return await self.PrepareVehicleNeedList();
}).then(async () => { }).then(async () => {
@@ -1409,13 +1413,13 @@ class AutomaticDispose {
// console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#vehicle_show_table_all input[type="checkbox"]:checked')); // console.log("Clicked Vehicles: ", $('#vehicle_show_table_all input[type="checkbox"]:checked').length, $('#vehicle_show_table_all input[type="checkbox"]:checked'));
// console.log("WILL KLICK SEND") // console.log("WILL KLICK SEND")
setTimeout(() => { setTimeout(function () {
self.UpdateMissionsToDone(self.MissionID).then(() => { self.UpdateMissionsToDone(self.MissionID).then(() => {
tellParent(`console.log('ok:${window.name}:${self.MissionID}');`); tellParent(`console.log('ok:${window.name}:${self.MissionID}');`);
window.$('#mission_alarm_btn').click(); window.$('#mission_alarm_btn').click();
}); });
}, 250); }.bind(self), 250);
}) })
}; };
@@ -1429,8 +1433,8 @@ class AutomaticDispose {
mutations.forEach(function (mutation) { mutations.forEach(function (mutation) {
if (mutation.attributeName === "style") { if (mutation.attributeName === "style") {
setTimeout(function () { setTimeout(function () {
alarming(self) alarming()
}, 500); }.bind(self), 500);
} }
}); });
}); });
@@ -1441,8 +1445,9 @@ class AutomaticDispose {
$div.click(); $div.click();
} else { } else {
setTimeout(function () { setTimeout(function () {
alarming(self) const self = this;
}, 250); alarming().bind(self)
}.bind(self), 250);
} }