APIs Available to Gadget JavaScript
The following table lists the available APIs and methods.
Name |
Parameters |
Description | ||
---|---|---|---|---|
<static> gadgets.window.adjustHeight(opt_height) |
opt_height (integer)—Preferred height in pixels. This parameter is optional. If the opt_height is not specified, the API attempts to fit the gadget to its content. |
Adjusts the height of the gadget. | ||
<static> gadgets.window.setTitle(title) |
title (string)—Preferred title of the gadget. |
Sets the title of the gadget. | ||
<static> gadgets.io.makeRequest (url, callback, opt_params) |
url (string)—Address from which content is fetched. callback (function)—Run after content from the url is fetched. opt_params (Map<String, String>)—Additional optional parameters to pass to the request. |
Fetches content from the provided URL and feeds that content into the callback function.
| ||
<static> gadgets.views.requestNavigateTo (view) |
view (string)—The view type to which the gadget is requesting to change. |
Sets the view type of the gadget. If the parameter value equals "canvas", the gadget is requesting to be maximized within the tab on which it resides. If any other value is provided, the gadget is requesting to be restored to its default view. | ||
<static> gadgets.loadingindicator.dismiss() | None | Dismisses the loading indicator so that the message is no longer visible. | ||
<static> gadgets.loadingindicator.showLoading() | None | Displays a loading indicator message over the gadget. | ||
<static> gadgets.loadingindicator.showRetry() | None | Displays an error message over the gadget stating that the gadget failed to load, along with a Retry button. When the user clicks the Retry button, the container reloads the gadget. | ||
<static> gadgets.loadingindicator.updateLoadingMessage(text) | text (string)—Text to display as the loading message. | Changes the message that appears when the gadget is loading. | ||
<static> gadgets.loadingindicator.updateTimeoutMessage(text) | text (string)—Text to display when the gadget loading has timed out. | Changes the message that appears when the gadget loading times out. | ||
<static> gadgets.loadingindicator.updateRetryButtonText(text) | text (string)—Text to display on the Retry button. | Changes the message that appears on the Retry button. |