跳转到内容

pivotick v3.0.0


pivotick / 通知程序

接口: Notifier ​

定义于:ui/Notifier.ts:197

在图形 UI 中管理和显示通知消息。

使用此组件向用户显示成功、警告、错误或信息消息。

示例 ​

ts
graph.notifier.warning('This is a warning', 'Content of the message goes here.')

通知还可以携带一个操作,并比默认的四秒有效,这就是结果如何撤消自身的方式:

ts
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

定义于:ui/Notifier.ts:234

参数 ​

title ​

string

message? ​

string

options? ​

Pick<Notification, "action" | "duration">

返回值 ​

NotificationHandle | undefined


info() ​

info(title, message?, options?): NotificationHandle | undefined

定义于:ui/Notifier.ts:238

参数 ​

title ​

string

message? ​

string

options? ​

Pick<Notification, "action" | "duration">

返回值 ​

NotificationHandle | undefined


notify() ​

notify(level, title, message?, options?): NotificationHandle | undefined

定义于:ui/Notifier.ts:216

向 UIManager 发送通知。

参数 ​

level ​

NotificationLevel

通知的严重级别。

title ​

string

要在通知中显示的标题。

message? ​

string

通知的可选详细消息。

options? ​

Pick<Notification, "action" | "duration">

提供的行动以及停留的时间。

返回值 ​

NotificationHandle | undefined

Toast 上的句柄,或无处可显示句柄的 undefined(一种没有通知槽的 UI 模式)。


success() ​

success(title, message?, options?): NotificationHandle | undefined

定义于:ui/Notifier.ts:226

参数 ​

title ​

string

message? ​

string

options? ​

Pick<Notification, "action" | "duration">

返回值 ​

NotificationHandle | undefined


warning() ​

warning(title, message?, options?): NotificationHandle | undefined

定义于:ui/Notifier.ts:230

参数 ​

title ​

string

message? ​

string

options? ​

Pick<Notification, "action" | "duration">

返回值 ​

NotificationHandle | undefined