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.

Accessors

Methods

  • Adds a close listener for a dialog element. The callback will be called when the dialog is closed.

    Parameters

    • dialog: string | HTMLDialogElement

      Dialog element or selector string for the dialog.

    • callback: UFDialogCallback

      Callback function to be called when the dialog is closed.

    Returns void

  • Adds an open listener for a dialog element. The callback will be called when the dialog is opened.

    Parameters

    • dialog: string | HTMLDialogElement

      Dialog element or selector string for the dialog.

    • callback: UFDialogCallback

      Callback function to be called when the dialog is opened.

    Returns void

  • Removes all close listeners for a dialog element.

    Parameters

    • dialog: string | HTMLDialogElement

      Dialog element or selector string for the dialog.

    Returns void

  • Removes all open listeners for a dialog element.

    Parameters

    • dialog: string | HTMLDialogElement

      Dialog element or selector string for the dialog.

    Returns void

  • Removes a close listener for a dialog element.

    Parameters

    • dialog: string | HTMLDialogElement

      Dialog element or selector string for the dialog.

    • callback: UFDialogCallback

      Callback function to be removed.

    Returns void

  • Removes an open listener for a dialog element.

    Parameters

    • dialog: string | HTMLDialogElement

      Dialog element or selector string for the dialog.

    • callback: UFDialogCallback

      Callback function to be removed.

    Returns void