Difference between revisions of "Gadgets.MiniMessage (v0.9)"

From VZ Developer Wiki
Jump to: navigation, search
(Created page with '{{NeedsExamples}} <div style="float:right; margin: 0 0 10px 10px;">__TOC__</div> <span style="font-size:150%"><strong>gadgets.MiniMessage</strong></span> MiniMessage class, use…')
 
(gadgets.MiniMessage.dismissMessage)
Line 50: Line 50:
 
<div style="margin-left:4em;">Dismisses the specified message.</div>
 
<div style="margin-left:4em;">Dismisses the specified message.</div>
  
 +
== Examples ==
 +
 +
<source lang="javascript">
 +
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";
 +
</source>
  
 
{{ JsApiAlphaList_(v0.9) }}
 
{{ JsApiAlphaList_(v0.9) }}

Revision as of 13:17, 30 July 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: <list style="symbols"> Status messages: loading, saving, etc. Promotional messages: new features, new gadget, etc. Debug/error messages: bad input, failed connection to server, etc. </list>

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

gadgets.io

gadgets.json

gadgets.Prefs

gadgets.util

gadgets.views

gadgets.flash

gadgets.MiniMessage

gadgets.oauth.Popup

gadgets.rpc

gadgets.skins

gadgets.pubsub

gadgets.Tab

gadgets.TabSet

gadgets.window

gadgets.i18n

opensocial

opensocial.Activity

opensocial.Address

opensocial.Album

opensocial.BodyType

opensocial.Collection

opensocial.CreateActivityPriority

opensocial.DataRequest

opensocial.DataResponse

opensocial.Email

opensocial.Enum

opensocial.Environment

opensocial.EscapeType

opensocial.IdSpec

opensocial.MediaItem

opensocial.Message

opensocial.MessageCollection

opensocial.Name

opensocial.NavigationParameters

opensocial.Organization

opensocial.Permission

opensocial.Person

opensocial.Phone

opensocial.ResponseItem

opensocial.Url

osapi.Request

osapi.BatchRequest

osapi.people

osapi.activities

osapi.appdata

osapi.messages

osapi.http