-
Notifications
You must be signed in to change notification settings - Fork 152
Notification API [to be implemented]
hackape edited this page Jul 24, 2017
·
5 revisions
Notification
应该跟 EventLog
结合在一起,EventLog
应该有个 UI 界面。
当前这个模块是基于 react-notifications
做的,要看看它的可扩展性如何,如果不行那就要自己做一个替代品。
interface NotificationProps {
action: string = 'Dismiss'
key: string = Date.now()
dismissAfter: string = 600
type: enum([ERROR, INFO])
message: string
}
interface NotificationManager {
private removeNotification (notifKey: string): void
private addNotification (notification: NotificationProps): Function
// return a dismiss function, to dismiss the notification added by invoking this method.
// 下面都是这个 addNotification 函数预先绑定好 notification.type 的 alias
// 普通类型通知
info(message: string): Function
info(notification: NotificationProps): Function
// 错误类型
error(message: string): Function
error(notification: NotificationProps): Function
// 不显示 popup 通知,直接进 eventLog
log(message: string): Function
log(notification: NotificationProps): Function
}