本文整理汇总了TypeScript中@ionic-native/local-notifications.LocalNotifications.schedule方法的典型用法代码示例。如果您正苦于以下问题:TypeScript LocalNotifications.schedule方法的具体用法?TypeScript LocalNotifications.schedule怎么用?TypeScript LocalNotifications.schedule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ionic-native/local-notifications.LocalNotifications
的用法示例。
在下文中一共展示了LocalNotifications.schedule方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Date
this.platform.ready().then(()=>{
this.localNotifications.schedule({
id: 1,
title: 'TrackoMed',
text: 'Sleep Time',
data: { mydata: 'Have you Slept Yet?' },
icon: '../../icon.png',
at: new Date(new Date().getTime() + 2 * 1000)
});
});
示例2: addFavorite
addFavorite(id: number): boolean {
if (!this.isFavorite(id)) {
this.favorites.push(id);
this.storage.set('favorites', this.favorites);
// Schedule a single notification
this.localNotifications.schedule({
id: id,
text: 'Dish ' + id + 'added as a favorite successfully'
});
}
console.log('favorites', this.favorites);
return true;
}
示例3: setInterval
this.interval = setInterval(() => {
this.now = new Date();
if (this.notifications) {
let { period, timeLeft } = this.getCurrentClassInfo();
if (period) {
this.notif.schedule({
id: 0,
title: period.name,
text: `${timeLeft} mins remaining`,
badge: timeLeft
});
}
}
}, 5000);