Alerts
Setup
First we need to create a new alerts instance.
import Alerts from 'BobjollAlerts'
const alerts = new Alerts({
fixed?: boolean; // if enabled timeout will be disabled and user has to close notification window.
timeout?: number; // Override default notification timeout.
template?: Function; // Override default notifications template.
position?: keyof Position; // Override default notifications position.
});
Usage
Alerts are very simple to use, but don't have a lot of options as they are meant to be a basic notification preset to alert styling.
alerts.new(html: string, type: AlertType, fixed = false);
Example 1
var example1 = document.getElementById('alerts-example-1');
var alerts1 = new Alerts({
fixed: true,
position: 'bottom-center',
});
if (example1) {
example1.addEventListener('click', function() {
alerts1.insert(html: '...', 'success', true);
});
}