- Description:
A system for displaying small snackbar notifications to users which disappear shortly after they are shown.
- Source:
- Copyright:
- 2019 Andrew Nicols
- 2019 Andrew Nicols
- License:
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
A system for displaying small snackbar notifications to users which disappear shortly after they are shown.
Members
(static, constant) removeToastRegion
- Description:
Remove a parent region.
This is useful in cases such as where a dialog is to be removed and the toast region should be moved back to the body.
- Source:
Remove a parent region.
This is useful in cases such as where a dialog is to be removed and the toast region should be moved back to the body.
Methods
(static) add(message, configuration)
- Description:
Add a new toast or snackbar notification to the page.
- Source:
Example
import {add as addToast} from 'core/toast';
import {getString} from 'core/str';
addToast('Example string', {
type: 'warning',
autohide: false,
closeButton: true,
});
addToast(getString('example', 'mod_myexample'), {
type: 'warning',
autohide: false,
closeButton: true,
});
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
message |
String | Promise.<string> | ||||||||||||||||||||||||||||||||||||
configuration |
Object |
Properties
|
(static) addToastRegion(parent)
- Description:
Add a new region to place toasts in, taking in a parent element.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
parent |
HTMLElement |