Javascript SDK Reference
Reference documentation for the Javascript SDK
The canonical url for the current of the Javascript SDK is https://alcmeon.com/widget/1.0/sdk.js. This SDK defines a single object named alcmeon
which defines the following attributes.
subscribe
Subscribe to notifications from the enclosing iframe.
Parameters
name | type | description |
callback | function callback(context) | A callback that will be invoked with a single argument of type Context |
Return value
There is no return value
See Also
The Context object reference: Context
Example usage
function handleContext(context) {
console.log(context);
}
alcmeon.subscribe(handleContext);
getAgent
Return the Agent who opened the currently-open iframe. This function can be invoked ONLY from within the callback given to the subscribe function.
Parameters
None
Return value
A object of type Agent:
Name | Type | Description |
id | integer | A unique id associated with the agent. |
name | string | A human-readable string associated with the agent. |
string | The email associated with the agent's account. |
Example usage
function handleContext(context) {
agent = alcmeon.getAgent();
console.log(agent.email);
}
alcmeon.subscribe(handleContext);
closeModal
Close the modal where the iframe hosting this code is inserted. Note: there is no expectation that this function should be invoked from within the context handler.
Parameters
None.
Return value
None.
Example usage
alcmeon.closeModal();
Updated over 2 years ago