Closed mylastore closed 2 years ago
Figure this out this is what I did:
usage: notifications.push(err.message, 'warning')
notifications store:
update((arr) => [...arr, {message, messageType}]
)
and on the implementation
<Notification let:payload duration="10000">
<p>Message Type: {payload.messageType}</p>
<span>{payload.message}</span>
</Notification>
Now I have message type example, success, warning, danger, success, info etc.
The values passed into the notifications array can be anything, the docs page only has a string as an example, but (as you seem to have figured out) you can indeed do:
import { notifications } from 'renderless-svelte';
notifications.push({ type: 'warning', text: 'This is a warning' });
I will have a look at making the documentation more explicit on this :)
How can I pass something like this: notifications.push(err.message, 'warning') to support notification type?