Skip to content

모듈: notifications

목차

기능

기능

cancelAllAsync

cancelAllAsync(label?): Promise<boolean>

예약된 알림을 모두 취소합니다.

Wortal.notifications.cancelAllAsync();

매개변수

이름 유형 설명
label? string 취소할 알림 카테고리의 임의 라벨입니다. 이 옵션을 사용하면 지정된 라벨의 알림만 취소됩니다.

Returns

Promise<boolean>

모든 알림이 성공적으로 취소되면 true를 반환하고, 그렇지 않으면 false를 반환하는 Promise.

Throws

  • NOT_SUPPORTED
  • OPERATION_FAILED

cancelAsync

cancelAsync(id): Promise<boolean>

예약된 알림을 취소합니다.

Wortal.notifications.cancelAsync("1234567890");

매개변수

이름 유형 설명
id string 취소할 알림 ID.

Returns

Promise<boolean>

알림이 성공적으로 취소되면 true를 반환하고, 그렇지 않으면 false를 반환하는 Promise.

Throws

  • NOT_SUPPORTED
  • INVALID_PARAM
  • OPERATION_FAILED

getHistoryAsync

getHistoryAsync(): Promise<ScheduledNotification[]>

지난 30일 동안 예약된 알림의 기록을 가져옵니다.

Example

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>

플레이어에게 전달할 알림을 예약합니다. 수신자 한 명당 최대 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);
});

매개변수

이름 유형 설명
payload NotificationPayload 예약된 알림을 정의하는 객체입니다.

Returns

Promise<NotificationScheduleResult>

Throws

  • NOT_SUPPORTED
  • INVALID_PARAM