UNNotificationTrigger:repeats 属性
repeats 属性表示送达之后是不是重新计时、再次送达。三种触发器都有它。
值
布尔。
true:送达之后重新计时,再次送达,直到这条请求被撤销。false:只送达一次。- 只读。给它赋值抛
TypeError:repeats is read-only。 - 建触发器时由
options.repeats决定,不带是false。远程推送的触发器上的值来自系统。
示例
js
const once = UNTimeIntervalNotificationTrigger.triggerWithTimeInterval(5);
const hourly = UNTimeIntervalNotificationTrigger.triggerWithTimeInterval(3600, { repeats: true });
console.log(once.repeats, hourly.repeats);结果:输出 false true。
对应的 iOS API
UNNotificationTrigger.repeats。
参见
triggerWithTimeInterval()、triggerWithDateMatchingComponents():建触发器时设- 这个类属于
@nacrejs/user-notifications包,装法见要先安装