本文整理匯總了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);