Toast
Toasts provide brief feedback about an operation through a message on the screen.
Let’s look at related App methods to work with Toast:
app.toast.create(parameters)- create Toast instance
- parameters - object. Object with toast parameters
Method returns created Toast’s instance
app.toast.destroy(el)- destroy Toast instance
- el - HTMLElement or string (with CSS Selector) or object. Toast element or Toast instance to destroy.
Method returns Toast’s instance
app.toast.open(el, animate)- opens Toast
- el - HTMLElement or string (with CSS Selector). Toast element to open.
- animate - boolean. Open Toast with animation.
Method returns Toast’s instance
app.toast.close(el, animate)- closes Toast
- el - HTMLElement or string (with CSS Selector). Toast element to close.
- animate - boolean. Close Toast with animation.
Method returns Toast’s instance
Method returns created Toast’s instance
Now let’s look at list of available parameters we need to create Toast:
Note that all following parameters can be used in global app parameters under toast
property to set defaults for all toasts. For example:
So to create Toast we have to call:
After that we have its initialized instance (like variable in example above) with useful methods and properties:
App and Toast Instance Events
Toast instance emits events on both self instance and app instance. App instance events has same names prefixed with toast
.