API Reference - JavaScript

This API reference is still in early developmental stages. As such, some information may be missing or out of date. However, please reference the latest code for a complete understanding of functionality and performance.

CAVRNUS TYPES

CavrnusSpaceConnection

This is the most important object in Cavrnus. It represents a user’s connection to a Space. As such it is used to access Properties, hook Users, etc.

CavrnusUser

This represents an individual user, and can be used to fetch their properties at runtime.

CavrnusSpace

This represents an individual space.

CAVRNUS FUNCTIONS

Core

initializeCsc

Sets up all static helpers and systems required for Cavrnus to run

Authentication

authenticateWithPassword

Gets user credentials, allowing you to join valid spaces and make other requests

authenticateAsGuest

Creates a guest user account with a given name and joins as that user

isLoggedIn

Checks if you are logged in

awaitAuthentication

Resolves a promise on any user authentication

Space Functions

fetchJoinableSpaces

Gets a list of all current spaces which can be joined

bindJoinableSpaces

Triggers when spaces become available to you that you can join, or when their metadata changes

isConnectedToAnySpace

Checks if there is any active connection to a space

joinSpace

Connects to a Space and begins recieving/processing the journal

awaitAnySpaceBeginLoading

Resolves a promise when attempting to join a space, returning the ID of the space being joined

awaitAnySpaceConnection

Resolves a promise immediately if you are already in a space, otherwise resolves as soon as you connect

exitSpace

Disconnects you from a given space.  You will stop receiving property updates

Color Property Functions

defineColorPropertyDefaultValue

Defines what the application will show if a new prop value has not been assigned

getColorPropertyValue

Gets the current property value, whether the default or the one currently set

bindColorPropertyValue

Triggers a callback function when the property changes, plus an initial callback when first bound

beginTransientColorPropertyUpdate

Begins a temporary property update. This will show for everyone in the space, but will not be saved unless you call Finish().

postColorPropertyUpdate

Updates the property value at the given path and synchronizes the data to the server

Boolean Property Functions

defineBooleanPropertyDefaultValue

Defines what the application will show if a new prop value has not been assigned

getBooleanPropertyValue

Gets the current property value, whether the default or the one currently set

bindBooleanPropertyValue

Triggers a callback function when the property changes, plus an initial callback when first bound

BeginTransientBooleanPropertyUpdate

Begins a temporary property update. This can be updated with UpdateWithNewData() This will show for everyone in the space, but will not be saved unless you call Finish().

postBooleanPropertyUpdate

Updates the property value at the given path and synchronizes the data to the server

Float Property Functions

defineFloatPropertyDefaultValue

Defines what the application will show if a new prop value has not been assigned

getFloatPropertyValue

Gets the current property value, whether the default or the one currently set

bindFloatPropertyValue

Triggers a callback function when the property changes, plus an initial callback when first bound

beginTransientFloatPropertyUpdate

Begins a temporary property update. This can be updated with UpdateWithNewData() This will show for everyone in the space, but will not be saved unless you call Finish().

postFloatPropertyUpdate

Updates the property value at the given path and synchronizes the data to the server

String Property Functions

defineStringPropertyDefaultValue

Defines what the application will show if a new prop value has not been assigned

getStringPropertyValue

Gets the current property value, whether the default or the one currently set

bindStringPropertyValue

Triggers a callback function when the property changes, plus an initial callback when first bound

beginTransientStringPropertyUpdate

Begins a temporary property update. This can be updated with UpdateWithNewData() This will show for everyone in the space, but will not be saved unless you call Finish().

postStringPropertyUpdate

Updates the property value at the given path and synchronizes the data to the server

Vector Property Functions

defineVectorPropertyDefaultValue

Defines what the application will show if a new prop value has not been assigned

getVectorPropertyValue

Gets the current property value, whether the default or the one currently set

bindVectorPropertyValue

Triggers a callback function when the property changes, plus an initial callback when first bound

beginTransientVectorPropertyUpdate

Begins a temporary property update. This can be updated with UpdateWithNewData() This will show for everyone in the space, but will not be saved unless you call Finish().

postVectorPropertyUpdate

Updates the property value at the given path and synchronizes the data to the server

Transform Property Functions

defineTransformPropertyDefaultValue

Defines what the application will show if a new prop value has not been assigned

getTransformPropertyValue

Gets the current property value, whether the default or the one currently set

bindTransformPropertyValue

Triggers a callback function when the property changes, plus an initial callback when first bound

beginTransientTransformPropertyUpdate

Begins a temporary property update. This can be updated with UpdateWithNewData() This will show for everyone in the space, but will not be saved unless you call Finish().

postTransformPropertyUpdate

Updates the property value at the given path and synchronizes the data to the server

User Property Functions

getUserSpeaking

Synchronously returns a boolean denoting if the user is speaking.

bindUserSpeaking

Binds an event to throw when the user starts/stops speaking.

getUserMuted

Synchronously returns a boolean denoting if the user is muted.

bindUserMuted

Binds an event to throw when the user mutes/un-mutes.

getUserStreaming

Synchronously returns a boolean denoting if the user is sharing a camera/video stream.

bindUserStreaming

Binds an event to throw when the user starts/stops sharing a camera/video stream.

getUserName

Synchronously returns a string of the user’s name.

bindUserName

Binds an event to throw when the user’s name changes.

bindProfilePic

Binds an event to throw when the user’s profile pic changes.

Space Users

awaitLocalUser

Throws an event when the local CavrnusUser arrives in the space

getCurrentSpaceUsers

Gives the list of current users in a space

bindSpaceUsers

Triggers whenever users join or leave a given space

bindUserVideoFrames

Throws an event with the user's current stream image

Voice and Video

setLocalUserMutedState

Set my muted state

setLocalUserStreamingState

Set my streaming state

fetchAudioInputs

Gets available microphones

updateAudioInput

Sets which microphone to use

fetchVideoInputs

Gets available camera/stream sources

updateVideoInput

Sets which camera/stream source to use