azure-devops-extension-sdk package

Classes

XDMChannel

Represents a channel of communication between frames\document Stays "alive" across multiple funtion\method calls

XDMObjectRegistry

Catalog of objects exposed for XDM

Interfaces

ContextIdentifier
GlobalizationContext
IExtensionContext

Identifier for the current extension

IExtensionInitOptions

Options for extension initialization -- passed to DevOps.init()

IHostContext

Information about the current DevOps host (organization)

IPageContext

Global context placed on each web page

ITeamContext

Information about the current DevOps team

IUserContext

Information about the current user

IJsonRpcMessage

Represents a remote procedure call (rpc) between frames.

ISerializationSettings

Settings related to the serialization of data across iframe boundaries.

IXDMChannel

Interface for a single XDM channel

IXDMChannelManager

Registry of XDM channels kept per target frame/window

IXDMObjectRegistry

Registry of XDM objects that can be invoked by an XDM channel

Enums

HostType

DevOps host level

Functions

applyTheme({[varName: string]: string})

Applies theme variables to the current document

getAccessToken()

Fetch an access token which will allow calls to be made to other DevOps services

getAppToken()

Fetch an token which can be used to identify the current user

getConfiguration()

Get the configuration data passed in the initial handshake from the parent frame

getContributionId()

Gets the information about the contribution that first caused this extension to load.

getExtensionContext()

Get the context about the extension that owns the content that is being hosted

getHost()

Gets information about the host (i.e. an Azure DevOps organization) that the page is targeting

getPageContext()

Get the context about the host page

getService<T>(string)

Get the contribution with the given contribution id. The returned contribution has a method to get a registered object within that contribution.

getTeamContext()

Gets information about the team that the page is targeting

getUser()

Gets information about the current user

getWebContext()

Get the context about the web

init(IExtensionInitOptions)

Initiates the handshake with the host window.

notifyLoadFailed(string | Error)

Notifies the host that the extension failed to load

notifyLoadSucceeded()

Notifies the host that the extension successfully loaded (stop showing the loading indicator)

ready()

Register a callback that gets called once the initial setup/handshake has completed. If the initial setup is already completed, the callback is invoked at the end of the current call stack.

register<T>(string, T)

Register an object (instance or factory method) that this extension exposes to the host frame.

resize(number, number)

Requests the parent window to resize the container for this extension based on the current extension size.

unregister(string)

Removes an object that this extension exposed to the host frame.

Function Details

applyTheme({[varName: string]: string})

Applies theme variables to the current document

function applyTheme(themeData: {[varName: string]: string})

Parameters

themeData

{[varName: string]: string}

getAccessToken()

Fetch an access token which will allow calls to be made to other DevOps services

function getAccessToken(): Promise<string>

Returns

Promise<string>

getAppToken()

Fetch an token which can be used to identify the current user

function getAppToken(): Promise<string>

Returns

Promise<string>

getConfiguration()

Get the configuration data passed in the initial handshake from the parent frame

function getConfiguration(): {[key: string]: any}

Returns

{[key: string]: any}

getContributionId()

Gets the information about the contribution that first caused this extension to load.

function getContributionId(): string

Returns

string

getExtensionContext()

Get the context about the extension that owns the content that is being hosted

function getExtensionContext(): IExtensionContext

Returns

getHost()

Gets information about the host (i.e. an Azure DevOps organization) that the page is targeting

function getHost(): IHostContext

Returns

getPageContext()

Get the context about the host page

function getPageContext(): IPageContext

Returns

getService<T>(string)

Get the contribution with the given contribution id. The returned contribution has a method to get a registered object within that contribution.

function getService<T>(contributionId: string): Promise<T>

Parameters

contributionId

string

Id of the contribution to get

Returns

Promise<T>

getTeamContext()

Gets information about the team that the page is targeting

function getTeamContext(): ITeamContext

Returns

getUser()

Gets information about the current user

function getUser(): IUserContext

Returns

getWebContext()

Get the context about the web

function getWebContext(): IWebContext

Returns

IWebContext

init(IExtensionInitOptions)

Initiates the handshake with the host window.

function init(options?: IExtensionInitOptions): Promise<void>

Parameters

options
IExtensionInitOptions

Initialization options for the extension.

Returns

Promise<void>

notifyLoadFailed(string | Error)

Notifies the host that the extension failed to load

function notifyLoadFailed(e: string | Error): Promise<void>

Parameters

e

string | Error

Returns

Promise<void>

notifyLoadSucceeded()

Notifies the host that the extension successfully loaded (stop showing the loading indicator)

function notifyLoadSucceeded(): Promise<void>

Returns

Promise<void>

ready()

Register a callback that gets called once the initial setup/handshake has completed. If the initial setup is already completed, the callback is invoked at the end of the current call stack.

function ready(): Promise<void>

Returns

Promise<void>

register<T>(string, T)

Register an object (instance or factory method) that this extension exposes to the host frame.

function register<T>(instanceId: string, instance: T)

Parameters

instanceId

string

unique id of the registered object

instance

T

Either: (1) an object instance, or (2) a function that takes optional context data and returns an object instance.

resize(number, number)

Requests the parent window to resize the container for this extension based on the current extension size.

function resize(width?: number, height?: number)

Parameters

width

number

Optional width, defaults to scrollWidth

height

number

Optional height, defaults to scrollHeight

unregister(string)

Removes an object that this extension exposed to the host frame.

function unregister(instanceId: string)

Parameters

instanceId

string

unique id of the registered object