FlashMessage
FlashMessage
is a UI component for displaying flash messages.
Learn more about the FlashMessage plugin.
constructorβ
constructor(options?: FlashMessage.Options)
The ui.FlashMessage
constructor accepts several parameters:
titleβ
[optional] The title of the flash message.
typeβ
[optional] The type of flash message. One of 'alert'
(default), 'warning'
, 'success'
, 'neutral'
.
contentβ
[optional] The content of the flash message. It can be either text or an arbitrary HTML.
modalβ
[optional] Set to true
if you want your flash message to be a modal.
closeAnimationβ
[optional] Set to false
if you don't want the flash message to be closed in an animated fashion. It can also be an
object of the form { delay: Number, duration: Number }
specifying properties of the close animation.
Methodsβ
open()β
flashMessage.open(): this;
Open the flash message.
on()β
flashMessage.on(eventName: string, callback: EventHandler, context?: any): this;
Register a handler function that will be called whenever eventName
is triggered. The optional context
is an object
that will be the context of the handler function (the this
).
Static Methodsβ
open()β
ui.FlashMessage.open(content: any, title?: any, opt?: FlashMessage.Options): void;
Open a flash message (the shorter way). opt
can contain any option that you can pass to the FlashMessage
constructor function (see the constructor section for details).
Eventsβ
The FlashMessage
object triggers events that you can react to. Events can be handled by using the on()
method.
close:animation:completeβ
Triggered when the flash message is actually removed from the DOM, i.e. when the close animation finishes.
closeβ
Triggered when the flash message gets closed.
Typesβ
Optionsβ
FlashMessage.Options extends Dialog.Options.
interface Options extends Dialog.Options {
cascade?: boolean,
closeAnimation?: false | {
delay?: number,
duration?: number,
easing?: string,
properties?: {
opacity?: number
}
},
openAnimation?: {
duration?: number,
easing?: string,
properties?: {
opacity?: number
}
}
}