code: function close(onClose, onAfterClose) {
    var container = getContainer();
    var popup = getPopup();
  
    if (!popup) {
      return;
    }
  
    if (onClose !== null && typeof onClose === 'function') {
      onClose(popup);
    }
  
    removeClass(popup, swalClasses.show);
    addClass(popup, swalClasses.hide);
  
    var removePopupAndResetState = function removePopupAndResetState() {
      if (!isToast()) {
        restoreActiveElement().then(function () {
          return triggerOnAfterClose(onAfterClose);
        });
        globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
          capture: globalState.keydownListenerCapture
        });
        globalState.keydownHandlerAdded = false;
      } else {
        triggerOnAfterClose(onAfterClose);
      }
  
      if (container.parentNode) {
        container.parentNode.removeChild(container);
      }
  
      removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['toast-column']]);
  
      if (isModal()) {
        undoScrollbar();
        undoIOSfix();
        undoIEfix();
        unsetAriaHidden();
      }
    }; // If animation is supported, animate
  
  
    if (animationEndEvent && !hasClass(popup, swalClasses.noanimation)) {
      popup.addEventListener(animationEndEvent, function swalCloseEventFinished() {
        popup.removeEventListener(animationEndEvent, swalCloseEventFinished);
  
        if (hasClass(popup, swalClasses.hide)) {
          removePopupAndResetState();
        }
      });
    } else {
      // Otherwise, remove immediately
      removePopupAndResetState();
    }
  }
docs: /*
  Global function to close sweetAlert