pivotick / 通知程序
接口: Notifier
在图形 UI 中管理和显示通知消息。
使用此组件向用户显示成功、警告、错误或信息消息。
示例
graph.notifier.warning('This is a warning', 'Content of the message goes here.')通知还可以携带一个操作,并比默认的四秒有效,这就是结果如何撤消自身的方式:
const toast = graph.notifier.success('Ingested 12 nodes', undefined, {
action: { label: 'Undo', onClick: (t) => { undo(); t.update({ title: 'Undone' }) } },
})方法
error()
error(
title,message?,options?):NotificationHandle|undefined
参数
title
string
message?
string
options?
Pick<Notification, "action" | "duration">
返回值
NotificationHandle | undefined
info()
info(
title,message?,options?):NotificationHandle|undefined
参数
title
string
message?
string
options?
Pick<Notification, "action" | "duration">
返回值
NotificationHandle | undefined
notify()
notify(
level,title,message?,options?):NotificationHandle|undefined
向 UIManager 发送通知。
参数
level
通知的严重级别。
title
string
要在通知中显示的标题。
message?
string
通知的可选详细消息。
options?
Pick<Notification, "action" | "duration">
提供的行动以及停留的时间。
返回值
NotificationHandle | undefined
Toast 上的句柄,或无处可显示句柄的 undefined(一种没有通知槽的 UI 模式)。
success()
success(
title,message?,options?):NotificationHandle|undefined
参数
title
string
message?
string
options?
Pick<Notification, "action" | "duration">
返回值
NotificationHandle | undefined
warning()
warning(
title,message?,options?):NotificationHandle|undefined
参数
title
string
message?
string
options?
Pick<Notification, "action" | "duration">
返回值
NotificationHandle | undefined