You are here: Docs Technical Documentation Clearspring APIs In-Widget API Placement

Placement

Placement Management

placement provides functions for managing existing placements.

 

Contents

API Reference

Name Type Description
placement.configure method Permanently updates the configuration of the running placement.

placement.configure

method

Permanently updates the configuration of the running placement. This call only succeeds when the user viewing the widget is the actual owner of the placement. To know whether this is the case, check context.user.IS_OWNER. Configuration parameters must have been registered in advance in our console or via widget.update.

Parameters
Name Type Required Purpose
Configuration object yes Maps parameter names to new values; e.g., if 'foo' and 'bar' are parameters, you could pass {foo: 'newfoo'} to update foo. bar will remain unchanged.
Return
None
Example Usage

AS2

if (_level0.cs.context.user.IS_OWNER) {
// Sets 'color' to red; sets 'number' to 6.
// Widget will be reloaded to display the new configuration,
// but will still count as the same user interaction session.
_level0.cs.placement.configure({color: 0xff0000, number: 6});
}

AS3

if (_api.context.user.IS_OWNER) {
// Sets 'color' to red; sets 'number' to 6.
// Widget will be reloaded to display the new configuration,
// but will still count as the same user interaction session.
_api.placement.configure({color: 0xff0000, number: 6});
}

JavaScript

// Note: Only available within JS kernel

if (_api.context.user.IS_OWNER) {
// Sets 'color' to red; sets 'number' to 6.
// Widget will be reloaded to display the new configuration,
// but will still count as the same user interaction session.
_api.placement.configure({color: 0xff0000, number: 6});
}
back to table