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

Implement alert fallback

parent cad37e08
No related branches found
No related tags found
No related merge requests found
import './vpu-notification'; import './vpu-notification';
import { send } from './notification'; import { send } from 'vpu-common/notification';
export { send }; export { send };
/**
* Sends a notification via the event
*
* 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,
});
window.dispatchEvent(event);
}
export { send };
import {i18n} from './i18n'; import {i18n} from './i18n';
import {send as notify} from './notification'; import {send as notify} from 'vpu-common/notification';
import {html, LitElement} from 'lit-element'; import {html, LitElement} from 'lit-element';
import './vpu-notification'; import './vpu-notification';
import commonUtils from 'vpu-common/utils'; import commonUtils from 'vpu-common/utils';
......
...@@ -56,6 +56,9 @@ class VPUNotification extends VPULitElement { ...@@ -56,6 +56,9 @@ class VPUNotification extends VPULitElement {
that.removeMessageId(messageId); that.removeMessageId(messageId);
}, timeout * 1000); }, timeout * 1000);
} }
// mark the event as handled
e.preventDefault();
}); });
this.updateComplete.then(()=>{ this.updateComplete.then(()=>{
......
common @ 3623e0d1
Subproject commit 68e0a4f1f1a3ef6e05aca5216bf8684578ec2229 Subproject commit 3623e0d1d062c1048ee37ac779d9425b56ffe26b
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