import { IObserver, IObserverConstructor, IObserverTypedConstructor } from '../../../core/observer/interfaces'; import { INotification } from '../notification/interfaces'; import { INotificationsObserverLike, TNotificationsObserverCallback } from './types'; /** INTERFACES **/ export interface INotificationsObserverConstructor extends Omit { new(name: TName, callback: TNotificationsObserverCallback): INotificationsObserver; } export interface INotificationsObserverTypedConstructor extends Omit>, 'new'> { new(name: TName, callback: TNotificationsObserverCallback): INotificationsObserver; } /** * A NotificationsObserver is an Observer filtering its incoming Notifications. * If the Notification has the same name than the Observer, then 'callback' is called with the Notification's value */ export interface INotificationsObserver extends IObserver>, INotificationsObserverLike { // the name to filter incoming notifications readonly name: TName; // the callback to call when notification passes the "name" filter readonly callback: TNotificationsObserverCallback; // returns true if "name" and "callback" are the same than this Observer's name and callback matches(name: string, callback?: TNotificationsObserverCallback): boolean; }