(protected) new RevisionsRequest()
The RevisionsRequest
object is created when requesting revisions for a document comparison. It triggers events to indicate revision retrieval progress and has properties to get the retrieved revisions and status.
This constructor should not be used directly. Instead, a revisions request is created by PCCViewer.ViewerControl#requestRevisions.
Example
// A RevisionsRequest object is created by and returned from the call to the requestRevisions method
var revisionsRequest = viewerControl.requestRevisions();
Members
(readonly) errorCode :number
Gets the error code if there was an error. If there was no error, null
will be returned.
An ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Type:
- number
(readonly) errorMessage :string
Returns a plain text, human-readable, fixed-local message that explains the error condition. If there was no error, null
will be returned.
An ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Type:
- string
(readonly) revisions :Array.<PCCViewer.Revision>
Gets an array of all revisions produced by this RevisionsRequest
up until this point.
An ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8.
Type:
- Array.<PCCViewer.Revision>
Methods
getErrorCode() → {number}
Returns the error code if there was an error. If there was no error, null
will be returned.
Example
var errorCode = revisionsRequest.getErrorCode();
Returns:
An error code indicating the type of error, or null.
- Type
- number
getErrorMessage() → {string}
Returns a plain text, human-readable, fixed-local message that explains the error condition. If there was no error, null
will be returned.
Example
var errorMessage = revisionsRequest.getErrorMessage();
Returns:
A plain text error message that explains the error condition, or null.
- Type
- string
getRevisions() → {Array.<PCCViewer.Revision>}
Returns an array of all revisions produced by this RevisionsRequest
up until this point.
Example
var revisions = revisionsRequest.getRevisions();
Returns:
An array of Revision
objects. If no results are found, this will be an empty array.
- Type
- Array.<PCCViewer.Revision>
off(eventType, handler) → {PCCViewer.RevisionsRequest}
Unsubscribe a handler from an event of the RevisionsRequest
.
Typically, event is unsubscribed when you no longer want further notification of the event.
Example
// subscribe
revisionsRequest.on(PCCViewer.EventType.RevisionsRetrievalCompleted, onRevisionsRetrievalCompleted);
// unsubscribe
revisionsRequest.off(PCCViewer.EventType.RevisionsRetrievalCompleted, onRevisionsRetrievalCompleted);
// handler declaration
function onRevisionsRetrievalCompleted(ev) {
alert("Revisions retrieval completed! Number of revisions: " + revisionsRequest.getRevisions().length);
}
Parameters:
Name | Type | Description |
---|---|---|
eventType |
string |
A string specifying the event type. See PCCViewer.RevisionsRequest#on for possible values. |
handler |
function |
The function that was previously subscribed to the event type. |
Returns:
The RevisionsRequest
object on which this method was called.
on(eventType, handler) → {PCCViewer.RevisionsRequest}
Subscribe a handler to an event of the RevisionsRequest
.
Example
// subscribe
revisionsRequest.on(PCCViewer.EventType.RevisionsRetrievalCompleted, onRevisionsRetrievalCompleted);
// handler declaration
function onRevisionsRetrievalCompleted(ev) {
alert("Revisions retrieval completed! Number of revisions: " + revisionsRequest.getRevisions().length);
}
Parameters:
Name | Type | Description |
---|---|---|
eventType |
string |
A string that specifies the event type.
|
handler |
function |
The function that will be called whenever the event is triggered. |
Returns:
The RevisionsRequest
object on which this method was called.