Optionaloptions: IOptionsDictionary of preference key-value pairs to apply
This method allows the gadget to communicate with player scripting. If the appropriate scripting is in place in the currently running template, calling this method will initiate a callback which can be acted upon in player script.
Rest...args: any[]variable number of arguments
Creates a typed wrapper for a Revel Digital data table.
The data table feature must be enabled for the gadget. The returned DataTableRef provides typed Promise-based methods and callback-based event handling for real-time row change events.
The data table ID (e.g. 'tbl_menu_items')
Optionaloptions: IDataTableOptionsOptional configuration overrides
A DataTableRef instance
const dt = client.createDataTable('tbl_menu_items');
// Fetch rows with filtering and sorting
const result = await dt.getRows({
filter: { category: 'Entree', price: { op: 'lte', value: 25 } },
sort: 'price',
sortDir: 'asc'
});
// Subscribe to real-time updates
dt.on('rowUpdated', (change) => console.log('Row updated:', change));
dt.on('rowCreated', (change) => console.log('Row created:', change));
dt.on('rowDeleted', (change) => console.log('Row deleted:', change));
// Cleanup when done
dt.dispose();
Creates a typed data table wrapper from a gadget preference value.
The preference JSON string (as serialized by the template editor's datatable
option) is parsed and used to auto-configure filter, sort, and logic settings.
The returned DataTablePrefRef provides a getFilteredRows() convenience
method that applies these settings automatically.
The raw gadget preference string (JSON)
Optionaloptions: IDataTableOptionsOptional configuration overrides
A DataTablePrefRef instance
const cfg = client.createDataTableFromPref(prefs.getString('rdDataTable'));
// Fetch rows with auto-wired filter + sort
const result = await cfg.getFilteredRows();
// Access the underlying DataTableRef for events, schema, etc.
cfg.dataTable.on('rowUpdated', (change) => console.log(change));
// Cleanup when done
cfg.dispose();
Returns the current device time in ISO8601 format. Current device time is determined by the device timezone assigned to the device in the CMS.
Optionaldate: DateOptional. If supplied will translate the supplied date/time to device time based on respective timezones.
Date/time in ISO8601 format
Accessor method for the user preferences interface exposed by the Gadgets API.
See https://developers.google.com/gadgets/docs/basic for more details on the Gadgets API.
When no player is attached — a local dev server, CMS preview, or a test — this falls
back to an in-memory MockPrefs, matching the mock fallback used by the rest of
the Client API. Unset preferences then read as '', false, 0, or []. This method
never throws and never returns undefined.
The returned object extends the Gadgets API Prefs surface with IPrefs.has
and nullable getters, which distinguish an unset preference from one deliberately
set to a falsy value.
Gadget API Prefs object, extended with existence-aware accessors
A session is a way of grouping events together. Each event has an associated session ID. Session ID's are randomly generated and reset by subsequent calls to newEventSession().
Each call to track() will utilize the same session ID, until another call to newEventSession().
Optionalid: stringOptional. User supplied session ID. If not supplied a random session ID will be generated.
Remove an event listener for the specified player event.
type of event to stop listening for
Optionalcallback: ((data: any) => void)Optional. The callback to remove, as passed to PlayerClient.on. If omitted, all listeners for this event type are removed.
Add an event listener for the specified player event.
Multiple listeners may be registered for the same event type. Registering the same
callback twice for the same event type is a no-op, matching addEventListener.
This method works with or without a player attached — events are delivered over
window, so createMockPlayer can drive the real event path in a test.
type of event to listen for
function to call when the event is triggered
Send a command to any remote player with the supplied device key(s). Note: Remote commands can only be delivered to devices within the same account as the sender device.
Array of remote device keys
Command name
Command arg
Log an event for use with AdHawk analytics. Events are used for tracking various metrics including usage statistics, player condition, state changes, etc.
Unique name for this event
Optionalproperties: IEventPropertiesA map of user defined properties to associate with this event
Applies configuration preferences to the gadget (preview mode only).
This method is only available when running in preview mode (typically during gadget development or testing in the CMS).