Skip to content
Snippets Groups Projects
Commit 217bb517 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire: Committed by Reiter, Christoph
Browse files

Add notification send function with alert fallback

parent 218580e9
No related branches found
No related tags found
No related merge requests found
/**
* Sends a notification via the event
*
* For type see: https://bulma.io/documentation/elements/notification/#colors
*
* example options:
*
* {
* "summary": "Item deleted",
* "body": "Item foo was deleted!",
* "type": "info",
* "timeout": 5,
* }
*
* @param options
*/
function send(options) {
const event = new CustomEvent("vpu-notification-send", {
bubbles: true,
cancelable: true,
detail: options,
});
const result = window.dispatchEvent(event);
// true means the event was not handled
if (result) {
alert((options.summary !== undefined && options.summary !== "" ? options.summary + ": " : "") + options.body)
}
}
export { send };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment