The client-side APIs are a collection of public methods and event handlers made available from the client application. The client application must be loaded on any page that renders user-editable content. Refer to
step 3 of the
Integration Guide for instructions on requesting the client application.
Namespaces
All JavaScript variables and objects used by the client application are stored within two restricted namespaces: a public namespace and a private namespace. The public namespace is called "WPCAPI" (Wetpaint Client API) and contains methods documented on this wiki. The private namespace is called "WPC" (Wetpaint Client) and does not support external interaction.
Payload
The initial payload includes only a minimum set of functionality to ensure timely loading of your web pages; additional code is retrieved on-demand as the user interacts with the client application.
Function Overriding
Some of the methods in the client application are intended to be overridden -- where you create a new function with exactly the same signature. Therefore, when we call the function, we will execute your code, rather than our code. Learn more about
function overriding.
Embedding JavaScript in Event Handlers
Embedding JavaScript event handlers in HTML elements is a very common practice; for example you might specify an onClick handler on an "Add a Page" button. Standard procedure is to render the decimal references of characters likely to conflict with the surrounding HTML or JavaScript, i.e. single quotes, double quotes, etc. Unfortunately a bug in Internet Explorer with interpreting single quote decimal references means some extra steps are necessary. Learn more about
single quotes, JavaScript, and event handlers.