UNPKG

@aotearoan/neon

Version:

Neon is a lightweight design library of Vue 3 components with minimal dependencies.

68 lines (67 loc) 1.64 kB
var c = Object.defineProperty; var v = (s, e, r) => e in s ? c(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r; var a = (s, e, r) => v(s, typeof e != "symbol" ? e + "" : e, r); import { NeonEventBus as i } from "../../common/event/NeonEventBus.es.js"; import { NeonAlertLevel as m } from "../../../model/feedback/alert/NeonAlertLevel.es.js"; const t = class t { /** * Send an info message. * * @param toast Info toast message. */ static info(e) { t.emit(m.Info, e); } /** * Send a success message. * * @param toast Success toast message. */ static success(e) { t.emit(m.Success, e); } /** * Send a warning message. * * @param toast Warning toast message. */ static warn(e) { t.emit(m.Warn, e); } /** * Send an error message. * * @param toast Error toast message. */ static error(e) { t.emit(m.Error, e); } /** * Remove a message. * * @param key Key of the message to delete. */ static remove(e) { i.emit(t.removeEventKey, e); } /** * Generate an event key so that all events are published on the correct topic. * * @param eventType Alert level of the event * * @returns The event key for sending a message on <a href="/utils/NeonEventBus">NeonEventBus</a>. */ static generateEventKey(e) { return `${i.messagePrefix}-toast-${e}`; } static emit(e, r) { const o = t.generateEventKey(e); i.emit(o, r); } }; a(t, "removeEventKey", `${i.messagePrefix}-toast-remove`); let n = t; export { n as NeonToastService }; //# sourceMappingURL=NeonToastService.es.js.map