notifications.cancelNotification()

类型 函数
返回值
修订版本 版本 2024.3703
关键词 notification, notifications, cancelNotification(通知,取消通知)
另请参阅 notifications.scheduleNotification()
notifications.*

概览

从计划任务、状态栏和/或通知中心移除指定的通知(或所有通知)。

语法

notifications.cancelNotification( [notificationId] )
notificationId (可选)

notifications.scheduleNotification() 返回的通知引用 ID。如果没有传入 ID,则取消所有通知。

示例

local notifications = require( "plugin.notifications.v2" )

-- Schedule a notification
local options = {
    alert = "Wake up!"
}

local notificationId = notifications.scheduleNotification( 60, options )

-- Cancel the above notification
notifications.cancelNotification( notificationId )