Adds the ability to dispatch notifications from anywhere within the application. Wrap the objects to be dispatched in an array to show multiple notifications at once.
- Source:
SHNotifications.add(
{
type: 'success'
message: 'Success message here.'
}
);
Methods
(static) add(data) → {void}
Adds a notification to the queue.
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
Object | The data to pass to the notification.
Properties
|
Returns:
- Type
- void
SHNotifications.add(
{
type: 'success'
message: 'Success message here.'
showClose: false,
autoClose: false,
duration: 2000,
cookie: {
name: 'nameOfCookie',
expires: 1
},
buttons: [
{
displayClass: 'Button',
clickClass: 'btn-label-1',
label: 'Label 1',
callback: cb,
callbackParams: [true, 'hello']
},
{
displayClass: 'Button-link',
clickClass: 'btn-label-2',
label: 'Label 2',
callback: cb2,
callbackParams: [this]
}
]
}
);