com.phloxui
Version:
PhloxUI Ng2+ Framework
133 lines (132 loc) • 6.22 kB
TypeScript
import { Notification } from '../component/model/Notification';
/**
* <p style="text-indent: 2em;">
* A <code>ng</code> service interface having main responsibilities on <code>application</code> notification <code>UI</code> logics.
* Please note that this class does NOT directly involve with server-side push notification logics. It's only a client-side
* API providing the way to interact with notification <code>UI</code> components. A [[Notification]] can be <code>pinned</code>
* on the screen --you can do this via [[pinNotification]] method. This will make it not to be removed from the screen when
* display timeout is reached unless the user clicks on the close button. All <code>unread</code> notifications --those which
* automatically removed when display timeout is reached-- will be displayed as a badge notification showing the number of
* <code>unread</code> items. You can also retrieve the list of <code>unread</code> items by using [[getUnreadNotifications]]
* method.
* </p>
*
* @author shiorin, tee4cute
* @see [[Notification]]
*/
export interface INotificationManager {
/**
* <p style="text-indent: 1em;">
* Notify user by displaying the given <code><b>notification</b></code> message on the screen.
* </p>
*/
notify(notification: Notification): void;
/**
* <p style="text-indent: 1em;">
* Remove the given <code><b>notification</b></code> from the <code>UI</code>. This also remove the notification message
* from <code>unread</code> and <code>pinned</code> items list.
* </p>
*/
clear(notification: Notification): void;
/**
* <p style="text-indent: 1em;">
* Remove all notifications which matches the given <code><b>notificationType</b></code> and <code><b>name</b></code>. This
* method also remove the notifications from <code>unread</code> and <code>pinned</code> items list.
* </p>
*
* @param notificationType A notification's type ([[Notification.type]]) to be cleared. Passing <code>null</code> means not to
* apply the filter on this field.
* @param name A notification's name ([[Notification.name]]) to be cleared. Passing <code>null</code> means not to
* apply the filter on this field.
*/
clearBy(notificationType: string, name: string): void;
/**
* <p style="text-indent: 1em;">
* Clear all notifications from the <code>UI</code>. This also remove all notification messages from <code>unread</code> and
* <code>pinned</code> items list.
* </p>
*/
clearAll(): void;
/**
* <p style="text-indent: 1em;">
* Get all notifications in the <code>UI</code>.
* </p>
*/
getNotifications(): Notification[];
/**
* <p style="text-indent: 1em;">
* Get all notifications in the <code>UI</code> by the given <code><b>notificationType</b></code> and <code><b>name</b></code>.
* </p>
*
* @param notificationType A notification's type ([[Notification.type]]) to filter. Passing <code>null</code> means not to apply the filter
* on this field.
* @param name A notification's name ([[Notification.name]]) to filter. Passing <code>null</code> means not to apply the filter on this field.
*/
getNotificationsBy(notificationType: string, name: string): Notification[];
/**
* <p style="text-indent: 1em;">
* Get all notifications being shown in the <code>UI</code>.
* </p>
*/
getShowingNotifications(): Notification[];
/**
* <p style="text-indent: 1em;">
* Get all notifications being shown in the <code>UI</code> by the given <code><b>notificationType</b></code> and <code><b>name</b></code>.
* </p>
*
* @param notificationType A notification's type ([[Notification.type]]) to filter. Passing <code>null</code> means not to apply the filter
* on this field.
* @param name A notification's name ([[Notification.name]]) to filter. Passing <code>null</code> means not to apply the filter on this field.
*/
getShowingNotificationsBy(notificationType: string, name: string): Notification[];
/**
* <p style="text-indent: 1em;">
* Get all <code>unread</code> notifications in the <code>UI</code>.
* </p>
*/
getUnreadNotifications(): Notification[];
/**
* <p style="text-indent: 1em;">
* Get all <code>unread</code> notifications in the <code>UI</code> by the given <code><b>notificationType</b></code> and <code><b>name</b></code>.
* </p>
*
* @param notificationType A notification's type ([[Notification.type]]) to filter. Passing <code>null</code> means not to apply the filter
* on this field.
* @param name A notification's name ([[Notification.name]]) to filter. Passing <code>null</code> means not to apply the filter on this field.
*/
getUnreadNotificationsBy(notificationType: string, name: string): Notification[];
/**
* <p style="text-indent: 1em;">
* Mark the given <code>notification</code> as <code>read</code>.
* </p>
*/
markAsRead(notification: Notification): void;
/**
* <p style="text-indent: 1em;">
* Mark <code>notification</code>s as <code>read</code> by the given <code><b>notificationType</b></code> and <code><b>name</b></code>.
* </p>
*
* @param notificationType A notification's type ([[Notification.type]]) to filter. Passing <code>null</code> means not to apply the filter
* on this field.
* @param name A notification's name ([[Notification.name]]) to filter. Passing <code>null</code> means not to apply the filter on this field.
*/
markAsReadBy(notificationType: string, name: string): void;
/**
* <p style="text-indent: 1em;">
* Mark all <code>notification</code>s as <code>read</code>.
* </p>
*/
markAsReadAll(): void;
/**
* <p style="text-indent: 1em;">
* Pin the given <code>notification</code> on the screen.
* </p>
*/
pinNotification(notification: Notification): void;
/**
* <p style="text-indent: 1em;">
* Unpin the given <code>notification</code> off the screen.
* </p>
*/
unpinNotification(notification: Notification): void;
}