- 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.
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 {get_string as 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 |