Skip to content

Commit a2ea9ce

Browse files
authored
docs(push): Add descriptions to push notification methods (#3036)
1 parent 319bd8a commit a2ea9ce

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

core/src/core-plugin-definitions.ts

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,21 +1599,74 @@ export interface NotificationChannelList {
15991599
}
16001600

16011601
export interface PushNotificationsPlugin extends Plugin {
1602+
/**
1603+
* Register the app to receive push notifications.
1604+
* Will trigger registration event with the push token
1605+
* or registrationError if there was some problem.
1606+
* Doesn't prompt the user for notification permissions, use requestPermission() first.
1607+
*/
16021608
register(): Promise<void>;
1609+
/**
1610+
* On iOS it prompts the user to allow displaying notifications
1611+
* and return if the permission was granted or not.
1612+
* On Android there is no such prompt, so just return as granted.
1613+
*/
16031614
requestPermission(): Promise<NotificationPermissionResponse>;
1615+
/**
1616+
* Returns the notifications that are visible on the notifications screen.
1617+
*/
16041618
getDeliveredNotifications(): Promise<PushNotificationDeliveredList>;
1619+
/**
1620+
* Removes the specified notifications from the notifications screen.
1621+
* @param delivered list of delivered notifications.
1622+
*/
16051623
removeDeliveredNotifications(delivered: PushNotificationDeliveredList): Promise<void>;
1624+
/**
1625+
* Removes all the notifications from the notifications screen.
1626+
*/
16061627
removeAllDeliveredNotifications(): Promise<void>;
1628+
/**
1629+
* On Android O or newer (SDK 26+) creates a notification channel.
1630+
* @param channel to create.
1631+
*/
16071632
createChannel(channel: NotificationChannel): Promise<void>;
1633+
/**
1634+
* On Android O or newer (SDK 26+) deletes a notification channel.
1635+
* @param channel to delete.
1636+
*/
16081637
deleteChannel(channel: NotificationChannel): Promise<void>;
1638+
/**
1639+
* On Android O or newer (SDK 26+) list the available notification channels.
1640+
*/
16091641
listChannels(): Promise<NotificationChannelList>;
1642+
/**
1643+
* Event called when the push notification registration finished without problems.
1644+
* Provides the push notification token.
1645+
* @param eventName registration.
1646+
* @param listenerFunc callback with the push token.
1647+
*/
16101648
addListener(eventName: 'registration', listenerFunc: (token: PushNotificationToken) => void): PluginListenerHandle;
1649+
/**
1650+
* Event called when the push notification registration finished with problems.
1651+
* Provides an error with the registration problem.
1652+
* @param eventName registrationError.
1653+
* @param listenerFunc callback with the registration error.
1654+
*/
16111655
addListener(eventName: 'registrationError', listenerFunc: (error: any) => void): PluginListenerHandle;
1656+
/**
1657+
* Event called when the device receives a push notification.
1658+
* @param eventName pushNotificationReceived.
1659+
* @param listenerFunc callback with the received notification.
1660+
*/
16121661
addListener(eventName: 'pushNotificationReceived', listenerFunc: (notification: PushNotification) => void): PluginListenerHandle;
1662+
/**
1663+
* Event called when an action is performed on a pusn notification.
1664+
* @param eventName pushNotificationActionPerformed.
1665+
* @param listenerFunc callback with the notification action.
1666+
*/
16131667
addListener(eventName: 'pushNotificationActionPerformed', listenerFunc: (notification: PushNotificationActionPerformed) => void): PluginListenerHandle;
1614-
16151668
/**
1616-
* Remove all native listeners for this plugin
1669+
* Remove all native listeners for this plugin.
16171670
*/
16181671
removeAllListeners(): void;
16191672
}

0 commit comments

Comments
 (0)