Toast notifications with different styles
simple(body: string, title?: string, config?: SnotifyConfig): number
success(body: string, title?: string, config?: SnotifyConfig): number
info(body: string, title?: string, config?: SnotifyConfig): number
warning(body: string, title?: string, config?: SnotifyConfig): number
error(body: string, title?: string, config?: SnotifyConfig): number
Toast notification of style - info and loading spinner. It changes style depending on success or error
promise|observable
.
You can change displayed data during the loading process using Observable.next()
async(body: string, title: string, action: Promise<SnotifyConfig> | Observable<SnotifyConfig>): number
Toast notification of style - confirm with buttons(configurable)
confirm(body: string, title: string, config: SnotifyConfig): number
Toast notification of style - confirm with buttons(configurable) and input field
prompt(body: string, title?: string, config: SnotifyConfig): number
setConfig(config: SnotifyConfig, options?: SnotifyOptions): void
Set global configuration object
get(id: number): SnotifyToast
Returns
SnotifyToast
object by id
remove(id?: number, remove?: boolean): void
If
id
passed, emits toast remove animation, ifid
&remove
passed, removes toast from notifications array instantly. If no param passed it is the same asclear()
clear(): void
Clear notifications array
onInit(toast?: SnotifyToast) => void
Emits on toast has been initialized
onHoverEnter(toast?: SnotifyToast) => void
Emits on
mouseenter
onHoverLeave(toast?: SnotifyToast) => void
Emits on
mouseleave
onClick(toast?: SnotifyToast) => void
Emits on
click
beforeDestroy(toast?: SnotifyToast) => void
Emits before toast starts to hide
afterDestroy(toast?: SnotifyToast) => void
Emits after toast has been hidden
onInput: (toast?: SnotifyToast, value?: string) => void
Emits at
prompt
input value change
onInit = 3
beforeDestroy = 0
afterDestroy = 1
onClick = 10
onHoverEnter = 11
onHoverLeave = 12
left_top = 'leftTop'
left_center = 'leftCenter'
left_bottom = 'leftBottom'
right_top = 'rightTop'
right_center = 'rightCenter'
right_bottom = 'rightBottom'
center_top = 'centerTop'
center_center = 'centerCenter'
center_bottom = 'centerBottom'
SIMPLE = 'simple'
SUCCESS = 'success'
ERROR = 'error'
WARNING = 'warning'
INFO = 'info'
ASYNC = 'async'
CONFIRM = 'confirm'
PROMPT = 'prompt'
Type: Number
Default: 2000
Description: Toast timeout in milliseconds. 0 - Disable timeout
Type: Boolean
Default: true
Description: Enable/Disable progress bar. Disabled if timeout is 0.
Type: SnotifyType
Default: Depends on toast type - success | async | error | etc...
Description: Type of toast, affects toast style. It's not recommended to change it.
Type: Boolean
Default: true
Description: Enable/Disable toast close by clicking on it
Type: Boolean
Default: true
Description: Enable/Disable pause on mouse enter
Type: SnotifyButton[]
Default:
[
{text: 'Ok', action: null, bold: true},
{text: 'Cancel', action: () => this.remove(id), bold: false},
]
// this.remove(id) - used inside service;
Description: Buttons config for Confirmation & Prompt types
Type: String
Default: Default: Enter answer here...
Description: Placeholder for Prompt toast
Type: Number
Default: 16
Description: Toast title maximum length
Type: Number
Default: 150
Description: Toast body maximum length
Type: string
Default: null
Description: Custom icon url/path.
Type: number
Default: -1
Description: Backdrop opacity. Range - 0.0 - 1.0
. Disabled -1
Type: SnotifyAnimate
Default: -1
Description: Backdrop opacity. Range - 0.0 - 1.0
. Disabled -1
Type: Number
Default: 8
Description: Max toast items on screen.
For example you want to display 3 toasts max at the time. But for some purposes your system calls it 10 times.
With this option, 3 toast will be shown. And after each of it will disappear, new toast from the queue will be shown.
Type: Boolean
Default: true
Description: Should new items come from top or bottom side.
This option created for styling purposes.
For example, if your toast position is TOP-RIGHT. It's not very nice, when items comes from top and pulls down all other toasts
Type: SnotifyPosition
Default: right_bottom
Description: Toasts position on screen
Type: Number
Default: 300
Description: Toast maximum height in pixels
Type: String
Default: 2000
Description: Toast timeout in milliseconds. 0 - Disable timeout
Type: Callback
Default: null
Description: Action which will be called after button click.
Type: Boolean
Default: Yes - true
| No - false
Description: Make button text bold or not
Type: SnotifyAction
Description: Toast lifecycle action (onInit, onDestroy, etc...)
Type: SnotifyToast
Description: Toast which triggered this action
Type: String
Description: Prompt toast input value
Type: String
Description: Toast Title
Type: String
Description: Toast message
Type: SnotifyConfig
Description: Toast configuration object
Type: 'fadeInLeft' | 'fadeInRight' | 'fadeInUp' | 'fadeInDown' | string;
Description: In animation
Type: 'fadeOutLeft' | 'fadeOutRight' | 'fadeOutUp' | 'fadeOutDown' | string;
Description: Out animation
Type: Number
Default: 400
Description: Animation time in ms
case SnotifyPosition.left_top:
{enter: 'fadeInLeft', exit: 'fadeOutLeft', time: 400}
case SnotifyPosition.left_center:
{enter: 'fadeInLeft', exit: 'fadeOutLeft', time: 400}
case SnotifyPosition.left_bottom:
{enter: 'fadeInLeft', exit: 'fadeOutLeft', time: 400}
case SnotifyPosition.right_top:
{enter: 'fadeInRight', exit: 'fadeOutRight', time: 400}
case SnotifyPosition.right_center:
{enter: 'fadeInRight', exit: 'fadeOutRight', time: 400}
case SnotifyPosition.right_bottom:
{enter: 'fadeInRight', exit: 'fadeOutRight', time: 400}
case SnotifyPosition.center_top:
{enter: 'fadeInDown', exit: 'fadeOutUp', time: 400}
case SnotifyPosition.center_center:
{enter: 'fadeIn', exit: 'fadeOut', time: 400}
case SnotifyPosition.center_bottom:
{enter: 'fadeInUp', exit: 'fadeOutDown', time: 400}
All interfaces can be imported from ng-snotify