@xui/components
Version:
xUI Components for Angular
40 lines (39 loc) • 1.76 kB
TypeScript
import { OverlayRef } from '@angular/cdk/overlay';
import { SnackBarContainer } from './snack-bar-container';
import { Observable } from 'rxjs';
/** Event that is emitted when a snack bar is dismissed. */
export interface XuiSnackBarDismiss {
/** Whether the snack bar was dismissed using the action button. */
dismissedByAction: boolean;
}
export declare class SnackBarRef<T> {
containerInstance: SnackBarContainer;
private overlayRef;
instance: T;
/** Subject for notifying the user that the snack bar has been dismissed. */
private readonly _afterDismissed;
/** Subject for notifying the user that the snack bar action was called. */
private readonly _onAction;
/**
* Timeout ID for the duration setTimeout call. Used to clear the timeout if the snackbar is
* dismissed before the duration passes.
*/
private durationTimeoutId;
/** Whether the snack bar was dismissed using the action button. */
private dismissedByAction;
constructor(containerInstance: SnackBarContainer, overlayRef: OverlayRef);
/** Dismisses the snack bar. */
dismiss(): void;
/** Marks the snackbar action clicked. */
dismissWithAction(): void;
/** Dismisses the snack bar after some duration */
_dismissAfter(duration: number): void;
/** Gets an observable that is notified when the snack bar is finished closing. */
afterDismissed(): Observable<XuiSnackBarDismiss>;
/** Gets an observable that is notified when the snack bar has opened and appeared. */
afterOpened(): Observable<void>;
/** Gets an observable that is notified when the snack bar action is called. */
onAction(): Observable<void>;
/** Cleans up the DOM after closing. */
private finishDismiss;
}