'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Business Analytics (C) Copyright IBM Corp. 2019 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /** * @class RenderingInfo * @hideconstructor * @classdesc Widget Service Implementation class */ define([], function () { var RenderingInfo = function () { function RenderingInfo(_ref) { var renderId = _ref.renderId; _classCallCheck(this, RenderingInfo); this._startTime = Date.now(); this._withData = false; this._renderSequenceWithData = undefined; this._sequenceIds = [renderId]; } /** * @public * @function getStartTime * @description get the start time of the render sequence * @returns {number} the start time in milliseconds */ RenderingInfo.prototype.getStartTime = function getStartTime() { return this._startTime; }; /** * @public * @function getEndTime * @description get the end time of the render sequence * @returns {number} the end time in milliseconds */ RenderingInfo.prototype.getEndTime = function getEndTime() { return this._endTime; }; /** * @public * @function setEndTime * @description set the end time of the render sequence * @param {number} endTime the end time of the render sequence */ RenderingInfo.prototype.setEndTime = function setEndTime(endTime) { this._endTime = endTime; }; /** * @public * @function setStartTime * @description set the start time of the render sequence * @param {number} startTime the start time of the render sequence */ RenderingInfo.prototype.setStartTime = function setStartTime(startTime) { this._startTime = startTime; }; /** * @public * @function getLastSequenceId * @description get the last sequence ID that was registered in RenderingInfo * @returns {number} the sequence ID of the last render recorded */ RenderingInfo.prototype.getLastSequenceId = function getLastSequenceId() { return this._sequenceIds[this._sequenceIds.length - 1]; }; /** * @public * @function getDuration * @description returns the duration of the render sequence * @return {number} the duration in milliseconds */ RenderingInfo.prototype.getDuration = function getDuration() { return this._endTime ? this._endTime - this._startTime : Date.now() - this._startTime; }; /** * @public * @function setWithData * @description set whether or not the render is with data or not * @param {boolean} withData */ RenderingInfo.prototype.setWithData = function setWithData(withData) { this._withData = withData; }; /** * @public * @function isWithData * @description whether or not the render being recorded is with data * @return {boolean} whether or not the render is with data */ RenderingInfo.prototype.isWithData = function isWithData() { return this._withData; }; /** * @public * @function registerSequenceId * @description register the current sequence ID * @param {number} sequenceId */ RenderingInfo.prototype.registerSequenceId = function registerSequenceId(sequenceId) { return this._sequenceIds.push(sequenceId); }; /** * @public * @function getRenderSequenceWithData * @description get the information for the data query tracking * @return {RenderSequenceInfo} the object containing the data for the data query */ RenderingInfo.prototype.getRenderSequenceWithData = function getRenderSequenceWithData() { return this._renderSequenceWithData; }; /** * @public * @function setRenderSequenceWithData * @description set the object for the render data information * @param {RenderSequenceInfo} renderSequenceWithData the object containing the information about the data query */ RenderingInfo.prototype.setRenderSequenceWithData = function setRenderSequenceWithData(renderSequenceWithData) { this._renderSequenceWithData = renderSequenceWithData; }; /** * @public * @function getSequenceIds * @description get the list of sequence IDs * @return {number[]} the array for sequence IDs */ RenderingInfo.prototype.getSequenceIds = function getSequenceIds() { return this._sequenceIds; }; /** * @public * @function toJSON * @description get the render information in JSON form * @returns {Object} the JSON object with all the rendering time information */ RenderingInfo.prototype.toJSON = function toJSON() { return { 'start time': this.getStartTime(), 'end time': this.getEndTime(), 'totalRenderingTime': this.getDuration(), 'sequenceIds': this.getSequenceIds(), 'sequenceWithData': this.getRenderSequenceWithData() ? this.getRenderSequenceWithData().toJSON() : {} }; }; return RenderingInfo; }(); return RenderingInfo; }); //# sourceMappingURL=RenderingInfo.js.map