# API
# Platforce API library
The Platforce-api.js
library provides API methods used to communicate with the CLM client.
# Installation
To use the Platforce API library, include it to the index.html
file with the following script tag:
script src="./Platforce-api.js"></script>
# API syntax reference
Once you include Platforce-api.js
to the presentation, the following methods are assigned to the window object:
openDocument(pathToDoc)—opens the PDF file located in the specified path.
- pathToDoc (String)—defines the path to the PDF file.
When user opens the PDF file, the CLM client uses the invokeEvent
method to dispatch the suspend
event on the window object. After closing the PDF file, the CLM client dispatches the proceed
event.
Example:
openDocument('media/test.pdf');
sendMail(options)—opens the native iOS controller to send an email with the subject, body, and attachments.
options (Object)—ontains fields that specify the email details. The
options
object must contain the following properties:to (String)—defines the email address of the intended recipient.
subject (String)—defines the email subject.
body (String)—defines the text message of the email (text should be URL-encoded).
attachments (String)—defines the attachments.
Example:
sendMail({
'to': 'platforce@support.com',
'subject': 'emailSubjectHere',
'body': 'emailBodyTextHere'
});
The CLM client uses the following methods defined in the Platforce-api.js
library to work with the presentation:
executeMethod(method)—used by the CLM client to execute the methods defined in the window object.
invokeEvent(eventName)—used by the CLM client to invoke the UI event on the window object. The list of the fired events:
suspend
—can be used to suspend the tracking of the slide browsing time. It's called from the CLM client's side when the PDF file from the slide is open and when user closes the presentation.proceed
—can be used to resume the tracking of the slide browsing time. It's called from the CLM client's side when user closes the PDF file.
The usage of the above-mentioned methods is described in more detailed later.