Gantt confirm before any event

I want to use confirm before any event fired.

	gantt.attachEvent("onBeforeTaskDrag", function (id, mode, e) {
		//any custom logic here
		gantt.confirm({
			text: "Veriler Değişecektir. Emin misiniz?",
			ok: "Yes",
			cancel: "No",
			callback: function (result) {
				if (result) {
					gantt.message("Yes!");
					confirm = true;

				} else {
					gantt.message("No...");
					confirm = false;
				}
			}
		});

		return true; // here returns true before callback function executed.
	});

https://forum.dhtmlx.com/t/confirm-drag-and-drop/12559

in this link example is shown but I want to use "confirm " result in other events,
I placed the other event in the function metioned above link, but both events works firstly event the result

I need to confirm an event before it happened. how can I do that?

Hello Komek,
Some event handlers are asynchronous otherwise the page would hang.
To make everything work in those event handlers, you need to return “false” (or in some cases do not return anything) by default. And then use the callback function in the confirm message.
Here is an example:
https://snippet.dhtmlx.com/ce5723d5d