Labs.Core.ILabHost

Office and SharePoint Add-ins

La dernière version de ce complément Office est disponible dans le référentiel GitHub des compléments.


S’applique à :apps for Office | Office Add-ins | Office Mix | PowerPoint

Provides an abstraction layer for connecting Labs.js to the host.

interface ILabHost

getSupportedVersions

getSupportedVersions(): Core.ILabHostVersionInfo[]

Retrieves the versions supported by the lab host.

Parameters

None.

connect

connect(versions: Core.ILabHostVersionInfo[], callback: Core.ILabCallback<Core.IConnectionResponse>)

Initializes a connection with the host.

Parameters

versions

List of host versions that the client can make use of.

callback

Callback function that fires when the connection is complete.

disconnect

disconnect(callback: Core.ILabCallback<void>)

Terminates communication with the host.

Parameters

completionStatus

Status of the lab at the time of the disconnection.

callback

Callback function that fires when the disconnect is complete.

on

on(handler: (string: any, any: any): void)

Adds an event handler for dealing with messages coming from the host. The resolved promise will be returned back to the host.

Parameters

handler

The event handler.

sendMessage

sendMessage(type: string, options: Core.IMessage, callback: Core.ILabCallback<Core.IMessageResponse>)

Sends a message to the host.

Parameters

type

The type of message being sent.

options

Message options.

callback

Callback function that fires once the message is received.

create

create(options: Core.ILabCreationOptions, callback: Core.ILabCallback<void>)

Creates the lab. Stores the host information and sets aside space for storing the configuration and other elements.

Parameters

options

Options passed as part of the create operation.

callback

Callback function that fires once the lab has been created.

getConfiguration

getConfiguration(callback: Core.ILabCallback<Core.IConfiguration>)

Retrieves the current lab configuration from the host.

Parameters

callback

Callback function to retrieve the configuration information.

setConfiguration

setConfiguration(configuration: Core.IConfiguration, callback: Core.ILabCallback<void>)

Sets a new lab configuration on the host.

Parameters

configuration

The lab configuration that is set.

callback

Callback function that fires once the configuration is set.

getConfigurationInstance

getConfigurationInstance(callback: Core.ILabCallback<Core.IConfigurationInstance>)

Retrieves the instance configuration for the lab.

Parameters

callback

Callback function that fires once the configuration instance has been retrieved.

getState

getState(callback: Core.ILabCallback<any>)

Retrieves the current state of the lab for a given user.

Parameters

completionStatus

Callback function that returns the current lab state.

setState

setState(state: any, callback: Core.ILabCallback<void>)

Sets the state of the lab for a given user.

Parameters

state

The lab state.

callback

Callback function that fires when state has been set.

takeAction

takeAction(type: string, options: Core.IActionOptions, callback: Core.ILabCallback<Core.IAction>)

Takes an attempt at an action.

Parameters

type

Type of action.

options

Options provided with the action.

callback

Callback function that returns the final executed action.

takeAction

takeAction(type: string, options: Core.IActionOptions, result: Core.IActionResult, callback: Core.ILabCallback<Core.IAction>)

Takes an action that has already been completed.

Parameters

type

Type of action.

options

Options provided with the action.

result

Result of the action.

callback

Callback function that returns the final executed action.

getActions

getActions(type: string, options: Core.IGetActionOptions, callback: Core.ILabCallback<Core.IAction[]>)

Takes an attempt at an action.

Parameters

type

Type of get action.

options

Options provided with the get action.

callback

Callback function that returns the list of completed actions.

Afficher: