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) {