Attach BeforeUnload Event

Hi, I found the way of attaching native event from this page:
https://docs.webix.com/desktop__event_handling.html

But, I only able to attach unload event which unable to stop the redirection. Hence, I wish to attach beforeunload event which allowed me to cancel and stop the user leaving the page if the data is edited in the page.

Appreciated if the team can prompt me and give me some example in snippet.

Hello,
onbeforeunload native event helps to call message.box which asks the user to decide to leave the page or not.
Generally, it looks like

window.onbeforeunload = function(e){ ... }

If you use Webix you need to use webix.event

webix.event(window, "beforeunload", function(e){ ... });