Skip to main content

foundation-notifications.sortnotificationbyseverity

Home > @genesislcap/foundation-notifications > sortNotificationBySeverity

sortNotificationBySeverity() function​

A ready-made sort comparator for use with NotifyContainerConfig.sortFn that places the most severe notifications at the top of the stack. Severity is determined by the notify attribute on each toast element: error (highest) → warning → success → unstyled (lowest).

Signature:

sortNotificationBySeverity: (a: HTMLElement, b: HTMLElement) => number

Parameters​

Parameter

Type

Description

a

HTMLElement

b

HTMLElement

Returns:

number

Example​

configureNotifications({ sortFn: sortNotificationBySeverity });