NativeMessageHandler class
Constructors
Native |
Methods
create |
Returns an instance of the MessageHandler that has successfully established a connection with an extension |
get |
Returns the Id for the browser extension this handler is communicating with |
get |
Returns the version for the browser extension this handler is communicating with |
is |
Returns boolean indicating whether or not the request should attempt to use native broker |
send |
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
Promise<NativeMessageHandler>
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
- config
- BrowserConfiguration
- 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>