From 6cdfb969143b58a990aa0605b47e3c062ed6ecef Mon Sep 17 00:00:00 2001 From: Norbert Renner Date: Tue, 17 May 2022 11:27:43 +0200 Subject: [PATCH] Fix async usage after update - change package dir - replace broken kill patch with remove filter --- gulpfile.js | 2 +- js/index.js | 5 ++++- js/router/BRouter.js | 10 ---------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 50e97d0..6666ea7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -50,7 +50,7 @@ var paths = { ]), scripts: [ 'node_modules/jquery/dist/jquery.js', - 'node_modules/async/lib/async.js', + 'node_modules/async/dist/async.js', 'node_modules/leaflet/dist/leaflet-src.js', ] .concat( diff --git a/js/index.js b/js/index.js index ae235c9..87d09ed 100644 --- a/js/index.js +++ b/js/index.js @@ -213,7 +213,10 @@ // abort pending requests from previous rerouteAllSegments if (!router.queue.idle()) { - router.queue.kill(); + router.queue.remove((task) => { + task.callback(L.BRouter.ABORTED_ERROR); + return true; + }); } routing.rerouteAllSegments(onUpdate); } diff --git a/js/router/BRouter.js b/js/router/BRouter.js index 6b272cd..530ff1b 100644 --- a/js/router/BRouter.js +++ b/js/router/BRouter.js @@ -26,16 +26,6 @@ L.BRouter = L.Class.extend({ }, this), 1 ); - - // patch to call callbacks on kill for cleanup (loadingTrailer) - this.queue.kill = function () { - var aborted = this.tasks; - this.drain = null; - this.tasks = []; - aborted.forEach(function (task) { - task.callback(L.BRouter.ABORTED_ERROR); - }); - }; }, setOptions: function (options) {