Editar

Compartilhar via


NativeMessageHandler class

Constructors

NativeMessageHandler(Logger, number, string)

Methods

createProvider(Logger, number)

Returns an instance of the MessageHandler that has successfully established a connection with an extension

getExtensionId()

Returns the Id for the browser extension this handler is communicating with

getExtensionVersion()

Returns the version for the browser extension this handler is communicating with

isNativeAvailable(BrowserConfiguration, Logger, NativeMessageHandler, AuthenticationScheme)

Returns boolean indicating whether or not the request should attempt to use native broker

sendMessage(NativeExtensionRequestBody)

Sends a given message to the extension and resolves with the extension response

Constructor Details

NativeMessageHandler(Logger, number, string)

new NativeMessageHandler(logger: Logger, handshakeTimeoutMs: number, extensionId?: string)

Parameters

logger

Logger

handshakeTimeoutMs

number

extensionId

string

Method Details

createProvider(Logger, number)

Returns an instance of the MessageHandler that has successfully established a connection with an extension

static function createProvider(logger: Logger, handshakeTimeoutMs: number): Promise<NativeMessageHandler>

Parameters

logger

Logger

handshakeTimeoutMs

number

Returns

getExtensionId()

Returns the Id for the browser extension this handler is communicating with

function getExtensionId(): string | undefined

Returns

string | undefined

getExtensionVersion()

Returns the version for the browser extension this handler is communicating with

function getExtensionVersion(): string | undefined

Returns

string | undefined

isNativeAvailable(BrowserConfiguration, Logger, NativeMessageHandler, AuthenticationScheme)

Returns boolean indicating whether or not the request should attempt to use native broker

static function isNativeAvailable(config: BrowserConfiguration, logger: Logger, nativeExtensionProvider?: NativeMessageHandler, authenticationScheme?: AuthenticationScheme): boolean

Parameters

logger

Logger

nativeExtensionProvider
NativeMessageHandler
authenticationScheme

AuthenticationScheme

Returns

boolean

sendMessage(NativeExtensionRequestBody)

Sends a given message to the extension and resolves with the extension response

function sendMessage(body: NativeExtensionRequestBody): Promise<object>

Parameters

Returns

Promise<object>