From a4b4c0ce61ff07d103176c8c0d9ca38164918106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20Fr=C3=B6hle?= Date: Tue, 18 Dec 2018 01:57:56 +0100 Subject: [PATCH] v2 - all functions need bind self --- dist/autoloader.js | 2 +- dist/autoloaderV2.js | 35 ++++++++++++++++++++--------------- src/autoloaderV2.js | 33 +++++++++++++++++++-------------- 3 files changed, 40 insertions(+), 30 deletions(-) diff --git a/dist/autoloader.js b/dist/autoloader.js index 2d42c12..663447f 100755 --- a/dist/autoloader.js +++ b/dist/autoloader.js @@ -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_URL = "https://jf.git.rest/Jomaar/automatic-dispose/raw/branch/"; var da_lss_adis_time = new Date().getTime(); diff --git a/dist/autoloaderV2.js b/dist/autoloaderV2.js index 6b0b031..03eeee3 100644 --- a/dist/autoloaderV2.js +++ b/dist/autoloaderV2.js @@ -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 * =============================================== @@ -17142,10 +17142,11 @@ class AutomaticDispose { setInterval(self.OpenNextPoliceSprechwunsch.bind(self), 5000); self.CollectPoliceSprechwuensche(); - setTimeout(() => { + setTimeout(function() { + const self = this; self.CollectMissions(); self.ReadAndAddMissions(); - }, 500); + }.bind(self), 500); self.ADisSettings.runner.forEach((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("vehicle_id", VehicleID); - self.RescueVehicleFrameWatchDog = setTimeout(async () => { + self.RescueVehicleFrameWatchDog = setTimeout(async function () { + const self = this; self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => { $("#adis-sprechwunsch-rescue-frame").attr("src", ""); $("#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("mission_id", MissionID); - self.PoliceVehicleFrameWatchDog = setTimeout(async (MissionID) => { + self.PoliceVehicleFrameWatchDog = setTimeout(async function (MissionID) { + const self = this; self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => { $("#adis-sprechwunsch-police-frame").attr("src", ""); $("#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) { self.WorkVerbandMission(); } - }, 250); + }.bind(self), 250); } } @@ -18600,7 +18603,8 @@ class AutomaticDispose { StartAlarmProcess() { const self = this; - const alarming = function alarming(self) { + const alarming = function alarming() { + const self = this; Promise.resolve().then(async () => { return await self.PrepareVehicleNeedList(); }).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("WILL KLICK SEND") - setTimeout(() => { + setTimeout(function () { self.UpdateMissionsToDone(self.MissionID).then(() => { tellParent(`console.log('ok:${window.name}:${self.MissionID}');`); window.$('#mission_alarm_btn').click(); }); - }, 250); + }.bind(self), 250); }) }; @@ -18670,8 +18674,8 @@ class AutomaticDispose { mutations.forEach(function (mutation) { if (mutation.attributeName === "style") { setTimeout(function () { - alarming(self) - }, 500); + alarming() + }.bind(self), 500); } }); }); @@ -18682,8 +18686,9 @@ class AutomaticDispose { $div.click(); } else { setTimeout(function () { - alarming(self) - }, 250); + const self = this; + alarming().bind(self) + }.bind(self), 250); } diff --git a/src/autoloaderV2.js b/src/autoloaderV2.js index b00212e..089a6a2 100644 --- a/src/autoloaderV2.js +++ b/src/autoloaderV2.js @@ -135,10 +135,11 @@ class AutomaticDispose { setInterval(self.OpenNextPoliceSprechwunsch.bind(self), 5000); self.CollectPoliceSprechwuensche(); - setTimeout(() => { + setTimeout(function() { + const self = this; self.CollectMissions(); self.ReadAndAddMissions(); - }, 500); + }.bind(self), 500); self.ADisSettings.runner.forEach((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("vehicle_id", VehicleID); - self.RescueVehicleFrameWatchDog = setTimeout(async () => { + self.RescueVehicleFrameWatchDog = setTimeout(async function () { + const self = this; self.RemoveRescueSprechwunschFromQueue(VehicleID).then((deleteCount) => { $("#adis-sprechwunsch-rescue-frame").attr("src", ""); $("#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("mission_id", MissionID); - self.PoliceVehicleFrameWatchDog = setTimeout(async (MissionID) => { + self.PoliceVehicleFrameWatchDog = setTimeout(async function (MissionID) { + const self = this; self.RemovePoliceSprechwunschFromQueue(MissionID).then((deleteCount) => { $("#adis-sprechwunsch-police-frame").attr("src", ""); $("#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) { self.WorkVerbandMission(); } - }, 250); + }.bind(self), 250); } } @@ -1359,7 +1362,8 @@ class AutomaticDispose { StartAlarmProcess() { const self = this; - const alarming = function alarming(self) { + const alarming = function alarming() { + const self = this; Promise.resolve().then(async () => { return await self.PrepareVehicleNeedList(); }).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("WILL KLICK SEND") - setTimeout(() => { + setTimeout(function () { self.UpdateMissionsToDone(self.MissionID).then(() => { tellParent(`console.log('ok:${window.name}:${self.MissionID}');`); window.$('#mission_alarm_btn').click(); }); - }, 250); + }.bind(self), 250); }) }; @@ -1429,8 +1433,8 @@ class AutomaticDispose { mutations.forEach(function (mutation) { if (mutation.attributeName === "style") { setTimeout(function () { - alarming(self) - }, 500); + alarming() + }.bind(self), 500); } }); }); @@ -1441,8 +1445,9 @@ class AutomaticDispose { $div.click(); } else { setTimeout(function () { - alarming(self) - }, 250); + const self = this; + alarming().bind(self) + }.bind(self), 250); }