Static
instanceReturns the singleton instance of the UFDialogListener
. The first time this is called,
the instance is created. Subsequent calls return the same instance.
Adds a close listener for a dialog element. The callback will be called when the dialog is closed.
Dialog element or selector string for the dialog.
Callback function to be called when the dialog is closed.
Adds an open listener for a dialog element. The callback will be called when the dialog is opened.
Dialog element or selector string for the dialog.
Callback function to be called when the dialog is opened.
Removes all close listeners for a dialog element.
Dialog element or selector string for the dialog.
Removes all open listeners for a dialog element.
Dialog element or selector string for the dialog.
Removes a close listener for a dialog element.
Dialog element or selector string for the dialog.
Callback function to be removed.
Removes an open listener for a dialog element.
Dialog element or selector string for the dialog.
Callback function to be removed.
This singleton class can be used to listen for dialogs being opened or closed. Not all browsers support toggle events for dialogs, so this class uses a MutationObserver to listen for changes to the 'open' attribute of dialog elements.