@gravito/flare
v2.0.0
Published
Lightweight, high-performance notification system for Gravito framework. Supports multiple channels (mail, database, broadcast, slack, sms) with zero runtime overhead.
Maintainers
Readme
@gravito/flare
Gravito 的通知模組,支援郵件、資料庫、廣播、Slack、SMS 等多種通道。
安裝
bun add @gravito/flare快速開始
import { Notification } from '@gravito/flare'
import type { MailMessage, Notifiable } from '@gravito/flare'
class WelcomeUser extends Notification {
via(user: Notifiable): string[] {
return ['mail']
}
toMail(user: Notifiable): MailMessage {
return {
subject: 'Welcome!',
view: 'emails.welcome',
to: user.email,
}
}
}const notifications = c.get('notifications')
await notifications.send(user, new WelcomeUser())