Functions
[getToastId(properties)]
Generates an identifier for a toast by inspecting the properties that differentiate toasts from one another.
[useToasts()] ⇒ Array.<Object>
A hook that provides access to the toast state and toast api.
Typedefs
[ToastProps]
Object containing data for creating toasts using addToast.
[API] : Object
The API for managing toasts. Use this API to add and remove toasts.
Generates an identifier for a toast by inspecting the properties that differentiate toasts from one another.
Parameters
ObjectStringtype property of ToastPropsStringmessage property of ToastPropsBooleantruedismissable property of ToastPropsString''actionText property of ToastPropsReact.Element()=>{}icon property of ToastPropsA hook that provides access to the toast state and toast api.
Returns: Array.<Object> — An array containing objects for the toast state and its API: [ToastState, API]
Object containing data for creating toasts using addToast.
Properties
StringStringBoolonDismiss is provided, this property is assumed to be true. This property is optional when creating toasts.React.ElementfunctionStringBoolStringfunctionNumber0 or false is passed, the toast will not timeout. This property is optional when creating toasts.The API for managing toasts. Use this API to add and remove toasts.
-
API :
Object- .removeToast(id)
- .addToast(toastProps) ⇒
Number
Removes a toast from the toast store.
Parameters
NumberDispatches an add action. Includes all props passed along with a hash id and a timeout id generated based on the incoming props.
Returns: Number — id The key referencing the toast in the store
Parameters
ToastPropsSource Code: pwa-studio/packages/peregrine/lib/Toasts/useToasts.js