From 6b9a6e3bc3439130bf42517fed4b867754e66bc2 Mon Sep 17 00:00:00 2001 From: PC-Axis Date: Wed, 9 Dec 2020 10:00:31 +0000 Subject: [PATCH] api.modal.confirm fixed for cross-browser compatibility --- src/js/api.library.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/js/api.library.js b/src/js/api.library.js index f545e2c..ca78225 100644 --- a/src/js/api.library.js +++ b/src/js/api.library.js @@ -511,11 +511,12 @@ api.modal.confirm = function (pMessage, pCallbackMethod, pCallbackParams) { $("#modal-confirm").find(".modal-body > p").empty().html(pMessage); $("#modal-confirm").find("[name=confirm]").once("click", function () { - // Close the Modal - $("#modal-confirm").modal('hide'); // Must wait for the async transition to finsh before invoking the callback function that may be a cascade confirm - // Consider refactoring by cloning the confir modal instead. - new Promise(resolve => setTimeout(resolve, 100)).then(() => { pCallbackMethod(pCallbackParams); }); + $("#modal-confirm").modal('hide').delay(100).queue(function () { + // https://stackoverflow.com/questions/10860171/run-function-after-delay + pCallbackMethod(pCallbackParams); + $(this).dequeue(); + }); }); // Force the modal to re-initialise before displaying in case of cascade confirm modals