Difference between revisions of "Gadgets.MiniMessage (v0.9)"
From VZ Developer Wiki
(→gadgets.MiniMessage.dismissMessage) |
|||
Line 4: | Line 4: | ||
<span style="font-size:150%"><strong>gadgets.MiniMessage</strong></span> | <span style="font-size:150%"><strong>gadgets.MiniMessage</strong></span> | ||
− | MiniMessage class, used to create messages that will appear to the user within the gadget. Typical use cases: | + | MiniMessage class, used to create messages that will appear to the user within the gadget. Typical use cases: |
+ | * Status messages: loading, saving, etc. | ||
+ | * Promotional messages: new features, new gadget, etc. | ||
+ | * Debug/error messages: bad input, failed connection to server, etc. | ||
== Methods == | == Methods == |
Revision as of 11:13, 2 August 2010
This documentation is not completed yet and will be extended by more examples in future.
gadgets.MiniMessage
MiniMessage class, used to create messages that will appear to the user within the gadget. Typical use cases:
- Status messages: loading, saving, etc.
- Promotional messages: new features, new gadget, etc.
- Debug/error messages: bad input, failed connection to server, etc.
Methods
gadgets.MiniMessage.createDismissibleMessage
HTMLElement createDismissibleMessage(message, opt_callback)
- Parameters
Name Type Description message String | Object The message as an HTML string or DOM element opt_callback Function Optional callback function to be called when the message is dismissed. The callback function will not be called until after the existing callstack has completed execution.
- Returns
Type Description HTMLElement HTML element of the created message
- Description
Creates a dismissible message with an [[]x] icon that allows users to dismiss the message. When the message is dismissed, it is removed from the DOM and the optional callback function, if defined, is called.
gadgets.MiniMessage.createStaticMessage
HTMLElement createStaticMessage(message)
- Parameters
Name Type Description message String | Object The message as an HTML string or DOM element
- Returns
Type Description HTMLElement HTML element of the created message
- Description
Creates a static message that can only be dismissed programmatically (by calling dismissMessage()).
gadgets.MiniMessage.createTimerMessage
HTMLElement createTimerMessage(message, seconds, opt_callback)
- Parameters
Name Type Description message String | Object The message as an HTML string or DOM element seconds number Number of seconds to wait before dismissing the message opt_callback Function Optional callback function to be called when the message is dismissed. The callback function will not be called until after the existing callstack has completed execution.
- Returns
Type Description HTMLElement HTML element of the created message
- Description
Creates a message that displays for the specified number of seconds. When the timer expires, the message is dismissed and the optional callback function is executed.
gadgets.MiniMessage.dismissMessage
dismissMessage(message)
- Parameters
Name Type Description message HTMLElement HTML element of the message to remove
- Description
Dismisses the specified message.
Examples
var msg = new gadgets.MiniMessage(__MODULE_ID__);
var statusMsg = msg.createDismissibleMessage("This is a critical error!");
// Change the message's background color to red
statusMsg.style.backgroundColor = "red";
statusMsg.style.color = "white";
OpenSocial (v0.9) | |||
gadgets.MiniMessage |