Module: notifications
目次
機能
機能
cancelAllAsync
▸ cancelAllAsync(label?): Promise<boolean>
スケジュール設定された通知をすべてキャンセルする。
例
Parameters
| Name | Type | Description |
|---|---|---|
label? |
string |
キャンセルする通知カテゴリの任意のラベル。こちらが使用された場合、指定されたラベルの通知のみ、キャンセルされます。 |
Returns
Promise<boolean>
すべての通知が正常にキャンセルされた場合は true を返し、そうでない場合は false を返す Promise。
Throws
- NOT_SUPPORTED
- OPERATION_FAILED
cancelAsync
▸ cancelAsync(id): Promise<boolean>
スケジュール設定された通知をキャンセルする。
例
Parameters
| Name | Type | Description |
|---|---|---|
id |
string |
キャンセルする通知 ID。 |
Returns
Promise<boolean>
通知が正常にキャンセルされた場合は true を返し、そうでない場合は false を返す Promise。
Throws
- NOT_SUPPORTED
- INVALID_PARAM
- OPERATION_FAILED
getHistoryAsync
▸ getHistoryAsync(): Promise<ScheduledNotification[]>
過去30日間にスケジュール設定された通知の履歴を取得する。
例
Wortal.notifications.getHistoryAsync().then((notifications) => {
notifications.forEach((notification) => {
console.log(notification.id);
console.log(notification.status);
});
});
Returns
Promise<ScheduledNotification[]>
スケジュール設定された通知の配列を含む Promise。
Throws
- NOT_SUPPORTED
- OPERATION_FAILED
scheduleAsync
▸ scheduleAsync(payload): Promise<NotificationScheduleResult>
プレーヤーに配信される通知をスケジュールします。受信者1人につき、スケジュール設定できる通知は5件までです。
例
Wortal.notifications.scheduleAsync({
title: "Your energy is full!",
body: "Come back and play again.",
mediaURL: "https://example.com/image.png",
label: "resources-full",
scheduleInterval: 300 // 5 minutes
}).then((result) => {
console.log(result.id);
});
Parameters
| Name | Type | Description |
|---|---|---|
payload |
NotificationPayload |
スケジュールされる通知を定義するオブジェクト。 |
Returns
Promise<NotificationScheduleResult>
Throws
- NOT_SUPPORTED
- INVALID_PARAM