@aotearoan/neon
Version:
Neon is a lightweight design library of Vue 3 components with minimal dependencies.
55 lines (54 loc) • 1.17 kB
JavaScript
import { NeonEventBus as s } from "./NeonEventBus.es.js";
import { NeonAlertLevel as r } from "../enums/NeonAlertLevel.es.js";
class e {
/**
* Send an info message.
*
* @param toast Info toast message.
*/
static info(t) {
e.emit(r.Info, t);
}
/**
* Send a success message.
*
* @param toast Success toast message.
*/
static success(t) {
e.emit(r.Success, t);
}
/**
* Send a warning message.
*
* @param toast Warning toast message.
*/
static warn(t) {
e.emit(r.Warn, t);
}
/**
* Send an error message.
*
* @param toast Error toast message.
*/
static error(t) {
e.emit(r.Error, t);
}
/**
* 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(t) {
return `${s.messagePrefix}-toast-${t}`;
}
static emit(t, i) {
const m = e.generateEventKey(t);
s.emit(m, i);
}
}
export {
e as NeonToastService
};
//# sourceMappingURL=NeonToastService.es.js.map