PMA.live Documentation by Pathomation

collaboration-doc.js

/**
 * Collaboration is a static class that provides the required methods to create, join and connect to sessions.
 * @namespace Collaboration
 */
export const Collaboration = {
    /**
     * Gets the slide loaders instances
     * @returns A list of slide loaders 
     */
    getLoaders: function () { },
	
	/**
    * Gets the annotation managers
    * @returns A list of annotation managers 
    */
    getAnnotationManagers: function () { },
	
    /**
     * Sets application specific data to be shared beetween participants of a session
     * @param {Object} data 
     */
    setApplicationData: function (data) { },

    /**
     * Gets application specific data shared beetween participants of a session
     * @retuns {Object} data 
     */
    getApplicationData: function () { },

    /**
     * Sets the current session's state to active or inactive
     * @param {boolean} active Set the session state to active or not
     */
    setSessionActive: function (active) { },

    /**
     * Gets the current session's state
     * @returns {boolean} Gets the session state
     */
    getSessionActive: function () { },

    /**
     * Sets whether or not every participant can control the viewports, or the master only
     * @param {boolean} everyoneInControl The value to set
     */
    setEveryoneInControl: function (everyoneInControl) { },

    /**
     * Gets the list of available sessions
     * @returns {Array<Collaboration~Session>} A list of sessions
     */
    getSessions: function () { },

    /**
     * Gets the current session
     * @returns {Collaboration~Session} The current session object
     */
    getCurrentSession: function () { },

    /**
    * Joins or creates a new session with the following parameters
    * @param {string} name The name of the session
    * @param {boolean} active Whether or not the session is active
    * @param {string} owner The owner of the session
    * @param {boolean} everyoneInControl Whether every participant can control the viewers
    * @returns A promise which resolves to the joined session
    */
    joinSession: function (name, active, owner, everyoneInControl) { },

    /**
     * Clears loaded images
     */
    resetImages: function () { },

    /**
    * Sets the maximun number of allowed slides
    * @param {number} numImages 
    */
    setNumberOfImages: function (numImages) { },

    /**
    * Disconnect the live connection
    */
    disconnect: function () { },

    /**
     * Gets the hub connection
     * @returns The signalr Hub connection
     */
    getHub: function () { },

    /**
     * Gets the API url to use
     * @returns the API url
     */
    getApiUrl: function () { },

    /**
     * Initiates a live connection between clients and viewers
     * @param {Collaboration~InitializeOptions} options The options to initialize the live with
     * @param {Array<Object>} components A List of components to initialize i.e. Chat, Board
     * @returns A promise to listen to when the connection is ready.
     */
    initialize: function (options, components) { },
}

/**
 * Session entity
 * @typedef {Object} Collaboration~Session
 * @property {number} id The session id
 * @property {boolean} active Whether the session is active
 * @property {string} name The name of the session
 * @property {Object} applicationData Any application specific data
 * @property {string} owner The owner of the session
 * @property {string} token The last token of the sesion
 * @property {number} numberOfImages The maximum allowed number of slide for this session
 * @property {boolean} everyoneInControl Whether every participant is in control of the viewports
 * @property {date} LastUpdated The date this session was last updated/used
 * @property {Array<SessionImage>} Images The list of slides used in this session
 */

/**
 * @typedef {Object} Collaboration~SessionImage
 * @property {number} id The slide unique id
 * @property {number} sessionId The session id this slide belongs to
 * @property {string} path The PMA.core path of this slide
 * @property {number} index The index of this slide in the list
 * @property {number} centerX The center pixel x of this slide in the viewport
 * @property {number} centerY The center pixel y of this slide in the viewport
 * @property {number} rotation The rotation of this slide
 * @property {boolean} flipX Whether this slide is flipped in the x-axis
 * @property {boolean} flipY Whether this slide is flipped in the y-axis
 * @property {number} resolution The current resolution of this slide in the viewport
 * @property {number} token The token for this slide
 * @property {string} channels The channels active for this slide in the viewport
 * @property {number} timeframe The active timeframe for this slide in the viewport
 * @property {number} layer The active layer for this slide in the viewport
 * @property {Array<ImageAnnotation>} annotations The list of drawed annotations on this slide
 */

/**
 * @typedef {Object} Collaboration~ImageAnnotation
 * @property {number} id The annotation's unique id
 * @property {number} sessionId The session id this annotation belongs to
 * @property {number} imageId The image id this annotation belongs to
 * @property {string} geometry The WKT geometry for this annotation
 * @property {number} lineThickness The thickness to draw this annotation
 * @property {string} color The html color to draw this annotation with
 * @property {string} fillColor The html color to fill this annotation with
 * @property {number} dimensions The number of dimensions for this annotation. 0 for point, 1 for linem 2 for closed shapes(polygons, closed polylines)
 * @property {string} notes The notes for this annotation if any
 * @property {string} Classification The classification for this annotation
 * @property {string} owner The owner for this annotation
 */

/**
 * Initialize a new session options
 * @typedef {Object} Collaboration~InitializeOptions
 * @property {boolean} master Whether you should be the master of this session
 * @property {string} pmaCoreUrl The PMA.core url to use
 * @property {string} apiUrl The PMA.live server api url to use
 * @property {string} hubUrl The PMA.live signalr hub url to use
 * @property {function} dataChanged A callback function called every time the application specific data is changed
 * @property {string} pointerImageSrc A relative url to an image to use as pointer
 * @property {string} masterPointerImageSrc A relative url to an image to use as a pointer for the master participant
 * @property {Collaboration~getSlideLoader} getSlideLoader A callback function which should return a slide loader for each slide
 */

/**
 * A function called every time a new slide needs to be loaded
 * @callback Collaboration~getSlideLoader
 * @params {number} i The slide index
 * @params {number} numberOfImages the max number of slides allowed
 * @return {SlideLoader} An instance of a PMA.UI.SlideLoader
 */