Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xerdi/meteor-toast
Admin-LTE Toasts for MeteorJS
https://github.com/xerdi/meteor-toast
adminlte meteor toast
Last synced: about 1 month ago
JSON representation
Admin-LTE Toasts for MeteorJS
- Host: GitHub
- URL: https://github.com/xerdi/meteor-toast
- Owner: Xerdi
- License: gpl-3.0
- Created: 2022-11-16T14:18:19.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-21T11:51:17.000Z (almost 2 years ago)
- Last Synced: 2024-11-11T14:44:41.788Z (3 months ago)
- Topics: adminlte, meteor, toast
- Language: JavaScript
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Meteor Toast
Admin-LTE Toasts for MeteorJS.
## Installation
Add the package to your project:
```shell
meteor add xerdi:toast
```Also see `xerdi:admin-lte` (requirement).
## Usage
The toast will by default be placed in `.toasts` which is included in `xerdi:admin-lte`.
To change that you can set `Toast.containerSelector` to your container.To show a toast, you can do the following:
```javascript
const toast = new Toast({
title: 'My Title',
icon: 'fas fa-icons',
image: '/path/to/image',
defaultAction: '/myMessages',
createdAt: new Date(),
close: false,
body: 'Hi there!',
'class': 'bg-danger'
});toast.show();
toast.hide();
```The toast will be destroyed when hidden.
There are also two short-hands for showing a success message or error message.
```javascript
Toast.success('A success message', {title: 'Title override'});
try {
// ... faulty code
} catch(e) {
Toast.error(e);
// or
Toast.error(e.reason)
}
```
When using these short-hands, the toast will be shown in advance.
The locale keys of the default titles are `xerdi:toast.errorTitle` and `xerdi:toast.successTitle`.