I have Page code that opens a lightbox based on async logic. When the logic completes I would like the same Page code to be able to close the lightbox.
Currently, only the Lightbox code can close the lightbox. So now the async logic has to be written in two places.
Ideally, a Page should be able to get a reference to the open lightbox or at least the lightbox it opened.
Would like to be able to do some/any of the following:
$w('#myLightbox').close(...)
wixWindow.lightbox.close(...)
wixWindow.closeLightbox('MyLightBox')
wixWindow.openLightbox('MyLightBox').then(lightbox => {
lightbox.onClose(onCloseMyLightBoxEventHandler);
lightbox.close(...);
})
const myLightbox = wixWindow.openLightbox('MyLightBox');
myLightbox.then(onCloseMyLightBoxEventHandler);
myLightbox.close(...);