Skip to content
Snippets Groups Projects
Select Git revision
  • a5be89913ca5e6229e96cb3dd70ec36dda965f49
  • main default protected
  • renovate/lock-file-maintenance
  • demo protected
  • person-select-custom
  • dbp-translation-component
  • icon-set-mapping
  • port-i18next-parser
  • remove-sentry
  • favorites-and-recent-files
  • revert-6c632dc6
  • lit2
  • advertisement
  • wc-part
  • automagic
  • publish
  • wip-cleanup
  • demo-file-handling
18 results

build-info.js

Blame
  • notification.js 828 B
    /**
     * Sends a notification via the event
     *
     * Type can be info/success/warning/danger
     *
     * example options:
     *
     * {
     *   "summary": "Item deleted",
     *   "body": "Item foo was deleted!",
     *   "type": "info",
     *   "timeout": 5,
     * }
     *
     * @param options
     */
    function send(options) {
        const event = new CustomEvent('dbp-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
            );
            console.log('Use the web component dbp-notification to show fancy notifications.');
        }
    }
    
    export {send};