Compartilhar via


LiveShareRuntime class

Runtime for LiveDataObject, which is used to do things like validate roles, get a timestamp

Constructors

LiveShareRuntime(ILiveShareHost, ILiveShareClientOptions, boolean)

Runtime for LiveDataObject.

Properties

canSendBackgroundUpdates

Setting for whether LiveDataObject instances using LiveObjectSynchronizer can send background updates. Default value is true.

host

ILiveShareHost instance

objectManager

LiveObjectSynchronizerManager instance

timestampProvider

ITimestampProvider instance

Methods

getClientInfo(string)

Get the client info for a given clientId

getTimestamp()

Returns the current timestamp as the number of milliseconds sine the Unix Epoch.

setAudience(IAzureAudience)

Set the audience for the runtime

setHost(ILiveShareHost, boolean)

Set the host for the runtime

start()

Start the timestamp provider

stop()

Stop the timestamp provider

verifyRolesAllowed(string, UserMeetingRole[])

Verifies that a client has one of the specified roles.

Constructor Details

LiveShareRuntime(ILiveShareHost, ILiveShareClientOptions, boolean)

Runtime for LiveDataObject.

new LiveShareRuntime(host: ILiveShareHost, options?: ILiveShareClientOptions, decorate?: boolean)

Parameters

host
ILiveShareHost

Host for the current Live Share session.

options
ILiveShareClientOptions

Optional. Options used for initializing LiveShareClient.

decorate

boolean

choose whether or not to automatically decorate host with BackwardsCompatibilityHostDecorator and LiveShareHostDecorator

Property Details

canSendBackgroundUpdates

Setting for whether LiveDataObject instances using LiveObjectSynchronizer can send background updates. Default value is true.

boolean canSendBackgroundUpdates

Property Value

boolean

host

ILiveShareHost instance

ILiveShareHost host

Property Value

objectManager

LiveObjectSynchronizerManager instance

LiveObjectManager objectManager

Property Value

LiveObjectManager

timestampProvider

ITimestampProvider instance

ITimestampProvider timestampProvider

Property Value

ITimestampProvider

Method Details

getClientInfo(string)

Get the client info for a given clientId

function getClientInfo(clientId: string): Promise<undefined | IClientInfo>

Parameters

clientId

string

Fluid clientId we are requesting user info for

Returns

Promise<undefined | IClientInfo>

IClientInfo object if the user is known, otherwise it will return undefined

getTimestamp()

Returns the current timestamp as the number of milliseconds sine the Unix Epoch.

function getTimestamp(): number

Returns

number

setAudience(IAzureAudience)

Set the audience for the runtime

function setAudience(audience: IAzureAudience)

Parameters

audience

IAzureAudience

IAzureAudience returned by AzureClient

setHost(ILiveShareHost, boolean)

Set the host for the runtime

function setHost(host: ILiveShareHost, decorate?: boolean)

Parameters

host
ILiveShareHost

ILiveShareHost to change

decorate

boolean

choose whether or not to automatically decorate host with BackwardsCompatibilityHostDecorator and LiveShareHostDecorator

start()

Start the timestamp provider

function start(): Promise<void>

Returns

Promise<void>

stop()

Stop the timestamp provider

function stop()

verifyRolesAllowed(string, UserMeetingRole[])

Verifies that a client has one of the specified roles.

function verifyRolesAllowed(clientId: string, allowedRoles: UserMeetingRole[]): Promise<boolean>

Parameters

clientId

string

Client ID to inspect.

allowedRoles

UserMeetingRole[]

User roles that are allowed.

Returns

Promise<boolean>

True if the client has one of the specified roles.