Applies to: io.Connect Desktop - JavaScript API
Question
How do I prevent a window from being refreshed (e.g., F5, Ctrl+R)?
Answer
Use the onRefreshing event on the current window and call prevent():
io.windows.my().onRefreshing((prevent) => {
prevent();
});
Question
How do I prevent a window from being closed?
Answer
Use onClosing the same way. Pass { showDialog: false } to suppress the default confirmation dialog:
io.windows.my().onClosing((prevent) => {
prevent({ showDialog: false });
});
Question
Can I also intercept navigation away from the page?
Answer
Yes. The same prevent() pattern is available on three window lifecycle events: onClosing, onRefreshing, and onNavigating.
Question
Can I enable these handlers through configuration instead of code?
Answer
Yes. Close and refresh handlers can be enabled globally or per application in the system configuration via the closeHandlers and refreshHandlers properties.