Override closeButton event handler
What I want to achieve is to hide window and keep the frame object when the close button is clicked, and make it possible to show the same window with frame.show().
I could not realize it with using only JSFrame interface or options and API. I tried setControl() etc, but no vail.
So I had to do workaround like below. (It uses JQuery but it is not substantial.)
Appreciate it if you show me how to do the same in a more proper manner.
let oJsFrame = new JSFrame();
oFrame = oJsFrame.create({`
title: 'Create Account Confirmation',
left: window.innerWidth / 2 - window.innerWidth / 4,
top: window.innerHeight / 2 - window.innerHeight / 4,
width: window.innerWidth / 2,
height: window.innerHeight / 2,
movable: true,
resizable: true,
html: "<div id=registration-popup>Something here</div>"
});
$("[component-id=closeButton]").unbind("click");
$("[component-id=closeButton]").attr("onclick", "");
oFrame.on("closeButton", "click", (_frame, _evt) => {
oFrame.hide();
});
+1 for the idea.
Your solution works nice, except the fact that the close animation is then hidden as well. A desired behavior would be the possibility to click the "close" button, but with the ability to re-open it again later (e.g. with oFrame.show() ).
The following code seems to not close completely the frame, show the animation, but oFrame.show() does not work anymore
oFrame.control.on('hid', (frame, info) => {
frame.hide();
});
It seems frame.control.doDehide is the trick - found in https://riversun.github.io/jsframe/examples/v150/chatbot_ui.html :
showChatWindow() {
const frame = this.jsFrame.getWindowByName(this.frameName);
//Open minimized window
frame.control.doDehide({
callback: (frame, info) => {
this.setChatButtonVisible(false);
}
});
}