CloudSession
- class cee.CloudSession()
The CloudSession’s responsibility is to manage the
Viewer
and the main event loop of EnvisionWeb ([[handleAnimationFrameCallback]]).All EnvisionWeb applications need a CloudSession object. There is only need for one, even in apps with multiple viewers, views, models and remote servers.
Constructors
Accessors
Methods
Constructors
constructor
- cee.CloudSession.constructor()
Constructor
- Return type
cee.CloudSession
Accessors
- cee.CloudSession.buildDateTimeString
Returns the date and time this version of EnvisionWeb was built
- cee.CloudSession.version
Returns the version of CEETRON Envision for Web
Format: Major.Minor.Patch-Build. E.g. ‘1.2.0+34145A’ or ’1.2.0-rc1++38C14A
- cee.CloudSession.viewerCount
Returns the number of viewers in the client application.
Methods
addModelToProcessingSet
- cee.CloudSession.addModelToProcessingSet(model)
Manually add a model to the set of models that need background processing
- Arguments
model (
cee.ProcessableModel
) –
- Return type
void
addViewer
- cee.CloudSession.addViewer(canvas, viewerOptions)
Adds a new Viewer to the session.
- Arguments
canvas (
HTMLCanvasElement
) –viewerOptions (
cee.ViewerOptions
) –
- Return type
cee.Viewer
The Viewer is tied to a HTML Canvas element, and the provided canvas must be capable of rendering WebGL. A Viewer can have many
View
and all the Views within a Viewer can share WebGL resources. So, to show the same Model in two Views, using one Viewer with two Views is more efficient than using two Viewers with one View each.A client application can contain many Viewers, but each Viewer must be linked to single unique Canvas.
deleteAllViewers
- cee.CloudSession.deleteAllViewers()
Deletes all viewers from the app.
- Return type
void
deleteViewerAt
- cee.CloudSession.deleteViewerAt(index)
Deletes the viewer at the given index.
- Arguments
index (
number
) –
- Return type
void
The index must be zero based and between 0 and viewerCount - 1
destroySession
- cee.CloudSession.destroySession()
Destroys the session object. This will delete all the viewers.
- Return type
void
getViewerArray
- cee.CloudSession.getViewerArray()
Returns a read only array with all viewers in the session
- Return type
ReadonlyArray[cee.Viewer]
getViewerAt
- cee.CloudSession.getViewerAt(index)
Returns the viewer with the given index.
- Arguments
index (
number
) –
- Return type
cee.Viewer
The index must be zero based and between 0 and viewerCount - 1
handleAnimationFrameCallback
- cee.CloudSession.handleAnimationFrameCallback(highResTimestamp_ms)
Mandatory update method for the CEETRON Envision Client.
- Arguments
highResTimestamp_ms (
number
) –
- Return type
boolean
This method must be called from a requestAnimationFrame() for animations to run and server communication to work as expected.
The standard code for doing this is:
// Setup timer to keep the session viewer up-to-date function myAnimationFrameCallback(highResTimestamp) { mySession.handleAnimationFrameCallback(highResTimestamp); requestAnimationFrame(myAnimationFrameCallback); } requestAnimationFrame(myAnimationFrameCallback);
removeModelFromProcessingSet
- cee.CloudSession.removeModelFromProcessingSet(model)
Remove a model that was previously added manually to the processing set
- Arguments
model (
cee.ProcessableModel
) –
- Return type
void