require(["deliteful/ToasterMessage"], function (ToasterMessage) {
new ToasterMessage();
});
ToasterMessage widget.
This class is not meant to be used alone. It needs to be combined with deliteful/Toaster.
Example
var toaster = new Toaster();
var message = new ToasterMessage({message: "hello, world!"});
toaster.postMessage(message);
Extends
- delite/Widget
Members
-
<static> dismissible :string
-
Indicates whether the message can be dismissed. Is one of ["on", "off", "auto"]. If "auto",
isDismissible
adopts a default behaviour that depends onduration
.Type:
- string
- Default Value:
- null
- Source:
-
<static> duration :number
-
Duration which specifies how long the message is shown. If set to a strictly negative value, the message is shown persistently until it is dismissed.
Type:
- number
- Default Value:
- 2000
- Source:
-
<static> message :string
-
Content of the message.
Type:
- string
- Default Value:
- null
- Source:
-
<static> messageTypeClass :string
-
A string containing the class that matches the type of the message.
Type:
- string
- Default Value:
- null
- Source:
-
<static> type :string
-
Type of the message.
type
is one of["info", "success", "warning", "error"]
.Type:
- string
- Default Value:
- "info"
- Source:
Methods
-
<static> dismiss(animation)
-
Dismisses the message, optionally with an animation.
Parameters:
Name Type Argument Description animation
string <optional>
an animation class that will be added to dismiss the message
-
<static> isDismissible() → {boolean}
-
Returns whether the message can be dismissed.
If the
dismissible
property was set to"on"
(respectively"off"
), this method returnstrue
(respectivelyfalse
). Ifdismissible
was set to"auto"
, this method returnsfalse
if the message is expirable,true
otherwise.Returns:
- Type
- boolean
-
<static> isExpirable() → {boolean}
-
Returns whether the message can expire. The default implementation returns
true
ifduration
is larger or equal than0
.Returns:
- Type
- boolean